Get Title from URL
source link: https://gist.github.com/steven-tey/4319a368d7fa4976493a66124e106050
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Get Title from URL · GitHub
Instantly share code, notes, and snippets.
lfgg, sick gist. ty king.
Nice! Just a note - this will not play well with cors sadly.
Nice! Just a note - this will not play well with cors sadly.
Can you give more detail? Why doesn't this work with CORS?
Can you give more detail? Why doesn't this work with CORS?
Sure. Given that this code can be run in node and in browser, browser will try to respect CORS rules on target website.
Hence running this for example: await getTitleFromUrl('https://www.kickstarter.com/projects/81monkeys/world-of-anterra')
would result in an error and return "No title found".
@Marcisbee thanks, that makes sense.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK