Coder Social home page Coder Social logo

oembed-node's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

finder-dp-lewis

oembed-node's Issues

Support youtu.be and https src in iframe

When I am trying to get youtube iframe, like this:

oembed.get({ url: 'https://youtu.be/1GWoMnYldYc/' }, function(err, result) {
    if (err) throw err;

    console.log('result', result);
});

I got the error:

undefined:1
Not Found
^
SyntaxError: Unexpected token N
    at Object.parse (native)
    at /Users/tavria/Sites/bem-md-renderer/node_modules/oembed-node/lib/request-handler.js:15:28
    at /Users/tavria/Sites/bem-md-renderer/node_modules/oembed-node/node_modules/curling/lib/curl-transport.js:57:5
    at ChildProcess.exithandler (child_process.js:645:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Socket.<anonymous> (child_process.js:966:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)

After a bit debugging, I found the problem. In this case link https://youtu.be/1GWoMnYldYc/ haven`t query 'v', so the module broken down.

I replaced code in this line https://github.com/hgarcia/oEmbed-node/blob/master/lib/providers/youtube.js#L15 to parsedUrl.pathname.split('/')[1]; and after that I had had the result.

But after this, I noticed, that the src of iframe had a http protocol, so on my site this video wont work, becase website working with https`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.