0

Get Title from URL

 1 year ago
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.
neoserver,ios ssh client

Get Title from URL · GitHub

Instantly share code, notes, and snippets.

Get Title from URL

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK