astro / node-oembed Goto Github PK
View Code? Open in Web Editor NEWoEmbed consumer library for node.js & tools
License: MIT License
oEmbed consumer library for node.js & tools
License: MIT License
If the url is https://youtu.be/0JUN9aDxVmI?t=32s, the response from node-oembed is
{"width":612,"author_url":"https://www.youtube.com/user/Harvard","title":"Advanced Algorithms (COMPSCI 224), Lecture 1","html":"<iframe width=\"612\" height=\"344\" src=\"https://www.youtube.com/embed/0JUN9aDxVmI?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe>","thumbnail_width":480,"version":"1.0","type":"video","thumbnail_url":"https://i.ytimg.com/vi/0JUN9aDxVmI/hqdefault.jpg","thumbnail_height":360,"height":344,"provider_name":"YouTube","author_name":"Harvard University","provider_url":"https://www.youtube.com/","original_url":"https://youtu.be/0JUN9aDxVmI?t=32s"}
But directly from youtube (https://www.youtube.com/oembed?url=https%3A%2F%2Fyoutu.be%2F0JUN9aDxVmI%3Ft%3D32s), it's
{"thumbnail_url":"https:\/\/i.ytimg.com\/vi\/0JUN9aDxVmI\/hqdefault.jpg","provider_url":"https:\/\/www.youtube.com\/","thumbnail_height":360,"type":"video","version":"1.0","author_url":"https:\/\/www.youtube.com\/user\/Harvard","author_name":"Harvard University","thumbnail_width":480,"width":480,"title":"Advanced Algorithms (COMPSCI 224), Lecture 1","provider_name":"YouTube","height":270,"html":"\u003ciframe width=\"480\" height=\"270\" src=\"https:\/\/www.youtube.com\/embed\/0JUN9aDxVmI?start=32\u0026feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e"}
Note you the iframe does not handle the 32s from node-oembed, but does from youtube.
It looks like the oembed providers require CORS to request info which means modules like this one can only be used server side.
Is this true?
With Souncloud the discover function return { 'text/xml+oembed': 'https://soundcloud.com/oembed?url=http%3A%2F%2Fsoundcloud.com%2Ffutureisnow%2Ff-ck-up-some-commas&format=xml',
'text/json+oembed': 'https://soundcloud.com/oembed?url=http%3A%2F%2Fsoundcloud.com%2Ffutureisnow%2Ff-ck-up-some-commas&format=json' }
Since the constant MIME_OEMBED_XML is 'text/xml+oembed', it is impossible to get JSON format on Soundcloud
Some really important Oembed website embed do not work.
Like:
When using some sites' oembed links, such as uproxx.com or rare.us, I get this error:
Please state who you are through the for query parameter.
PR #5 is a required change now for node 6.x and later since util.pump went from deprecated to gone, but the last published version in the npm registry is from before that fix. Could you please publish a new version out to npm? I'll point to this repo in the mean time but I'm sure others are hitting this issue as well. ๐
I had a crash when I tried to fetch the following URL: http://www.tatw.co.uk/podcast.xml
I also use embed.ly.
Stack trace
/Users/pronebird/dev/homejs/node_modules/oembed/lib/oembed.js:115
attrs.rel === 'alternate' &&
^
TypeError: Cannot read property 'rel' of undefined
at Object.DiscoveryHandler.writeTag (/Users/pronebird/dev/homejs/node_modules/oembed/lib/oembed.js:115:11)
at Parser$writeHandler as writeHandler
at Parser$parseTags as parseTags
at Parser$parseChunk as parseChunk
at Discovery.write (/Users/pronebird/dev/homejs/node_modules/oembed/lib/oembed.js:78:17)
at IncomingMessage.exports.pump (util.js:496:21)
at IncomingMessage.EventEmitter.emit (events.js:126:20)
at IncomingMessage._emitData (http.js:359:10)
at HTTPParser.parserOnBody as onBody
at Socket.socketOnData as ondata
16 Nov 23:22:59 - [nodemon] app crashed - waiting for file changes before starting...
Is there a way to set a time-out in node-oembed? When calling some URLs they just hang forever.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.