npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oembed-node

v0.4.0

Published

A node library to consume oEmbed providers, support for Vimeo and Youtube at the moment

Downloads

43

Readme

oembed-node

Build Status

A node library to consume some providers of oEmbed.

At the moment it only supports YouTube and Vimeo but you can easily extend it to work with others via custom providers.

Usage

var oembed = require('oembed-node').init();
oembed.get({url: "https://vimeo.com/62584176"}, getVideo);
function getVideo(err, result) {

}

The result will be a literal object with the properties returned by the provider. The library adds a video_url property to the object.

Custom providers

The init method of the library takes a literal object that's a map from host names to functions. Each of those functions is the handler that will return a proper oEmbed end point.

For example a custom provider for vimeo would be like this:

var customProviders = {
  "vimeo.com" : {
    init: function (urlStr) {
      return {
        getUrls: function () {
          return {
            embed: "http://vimeo.com/api/oembed.json?url=" + urlStr,
            video: urlStr
          };
        }
      };
    }
  }
};

And you can pass it to the init function of the module.

var oembed = require('oembed-node').init(customProviders);

You can use the same handler for multiple host names, just associate it to other keys in the hash.

Changelog

0.4.0 - Removed support for Revision3 (their oEmbed enpoint is not working) Fixed error handler for request module. Fixed error when trying to read youtu.be urls.

0.3.0 - Fixed bug on custom providers to actually call init thanks to [PR #6] (https://github.com/hgarcia/oEmbed-node/pull/6) (Originally reported on [PR #1] (https://github.com/hgarcia/oEmbed-node/pull/1) but build was broken) Removed support for Justin.tv thanks to PR #6 (Originally reported on PR #4 but build was broken) Added support for rutube.ru thanks to PR #3

0.2.0 - Fixed a bug supporting YouTube with multi query parameters Added support for Justin.tv Added support for Revision3 Added support for yFrog

0.1.0 - Initial release support for Vimeo and YouTube

Collaborators

Thanks to PR from aulizko and finder-dp-lewis pushed me to update the library and release v0.3.0