zolrath / obsidian-auto-link-title

Automatically fetch the titles of pasted links
MIT License
415 stars 55 forks source link

General fixes and updates #91

Closed khaosdoctor closed 6 months ago

khaosdoctor commented 8 months ago

Also after #90 which is a real bug, I saw #87 and #88 and decided to take another look and did some general improvements:

  1. Removed hashblock maker for a simpler approach using a faster RandomBytes
  2. Removed Electron-based scraper and settled for the initial approach of requesting the URL directly using Obsidian's API, it worked for all the tested URLs here but can be edge cases
  3. General package updates
  4. Remove all var
zolrath commented 6 months ago

Let me do some testing here, I definitely had some reported edge cases which pushed me in the other scraping direction but with the version changes that have happened to electron it's possible the situation has improved and we can streamline this.

Thanks!

zolrath commented 6 months ago

Though, the workaround people have been using with ObsidianCustomFrames for sites that require login don't work with this method as far as I can tell from a quick test. We'll have to look to see if there's a workaround with this method or if I'll need to supply an option to use the other method.

khaosdoctor commented 6 months ago

Though, the workaround people have been using with ObsidianCustomFrames for sites that require login don't work with this method as far as I can tell from a quick test. We'll have to look to see if there's a workaround with this method or if I'll need to supply an option to use the other method.

That's true, I haven't tested any sites with a log-in included, one thing that we can do is to scrape for OpenGraph tags like og:title or twitter:title like I do in this package which is, at least as far as I know, correct in most websites, including the ones that need a log in since these tags are usually filled with the content title by SEO and other content providers, so we could start by trying to get OG tags and falling back to title and no-title.