larryhudson / astro-sqlite-tts-feed

astro-sqlite-tts-feed
5 stars 0 forks source link

Idea: automatically get the title from webpage if not provided #8

Closed larryhudson closed 1 year ago

larryhudson commented 1 year ago

It's pretty annoying that we need to copy and paste in the title when we're adding a new article. It's especially annoying when I'm trying to quickly add a new article on my phone.

I should be able to set this up so that if no title is provided, it gets the article title from the URL. @extractus/article-extractor may be able to do this on the text to speech side, and yt-dlp can do it on the yt-dlp side.

There may be instances where @extractus/article-extractor can't get the article title. So I might need a more generic solution that can get the article title from the URL. Will have a look at npm for that.

larryhudson commented 1 year ago

There is this npm library, get-title-at-url: https://www.npmjs.com/package/get-title-at-url

Looking at the source code, it looks like it combines another package, article-title, with axios. It looks like article-title does some interesting stuff that compares the title tag with the h1 on the page and that sort of thing. I trust Sindre Sorhus!

I can probably just write my own utility function that fetches the URL and uses article-title.

larryhudson commented 1 year ago

This is done now!