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

embed-url

v0.0.6

Published

Extract and embed content from third party providers

Downloads

15

Readme

Build Status

Embed Url

A small library that allows to embed and extract content from third party providers url. This module manage:

  • Dailymotion video urls
  • Flickr photo urls
  • Instagram post urls
  • Pinterest board and pin urls
  • Tumblr post urls
  • Twitter urls (Tweets)
  • Vimeo video urls
  • Youtube video urls

Prerequisites

Node.js - Version >=4.3.2

Installation

Use npm:

$ npm install embed-url --save

Or you can clone and install HEAD:

git clone https://github.com/tekdreams/embed-url.git
cd embed-url
npm install

Getting Started

For some providers, credentials configurations are mandatory. To start using the embed-url module with Flickr, Instagram, Tumblr, Twitter, Youtube Urls, don't forget to update the credentials concerned in the "provider-config/credentialsConfig.js" file.

How to get the credentials:

  • Instagram: https://www.instagram.com/developer/

  • Flickr: https://www.flickr.com/services/api/misc.api_keys.html

  • Tumblr: https://www.tumblr.com/docs/en/api/v2

  • Twitter: https://apps.twitter.com/

  • Youtube: https://developers.google.com/youtube/v3/getting-started

This module utilizes ES6 Promises to handle the API calls.

Usage

const embedurl = require('embed-url');

To extract datas from a single url use the following...

embedurl.url(URL_TO_EXTRACT)
    .then(result => {
    	// do stuff
    	console.log("Embed url", result)
    })
    .catch(error => {
    	// errors will bubble up through the reject method of the promise.
        // you'll want to console.log them otherwise it'll fail silently
        console.log("Error", error)
    })

The result returned in from the promise will be a Result object.

Returned Data

The API returns an object. Below is an example

{ mediaId: '1552321983961937074_25998477',
  title: 'Sem Photoshop, é rosa mesmo! 😉👍🏼 #lascoloradas #yucatán #mexico #roadtrip',
  embedUrl: 'https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/19624133_1476073882469010_4796107352862359552_n.jpg?ig_cache_key=MTU1MjMyMTk4Mzk2MTkzNzA3NA%3D%3D.2&se=8',
  thumbnail: 'https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/19624133_1476073882469010_4796107352862359552_n.jpg?ig_cache_key=MTU1MjMyMTk4Mzk2MTkzNzA3NA%3D%3D.2&se=8',
  provider: 'instagram',
  url: 'https://www.instagram.com/p/BWK9J6vFLSy/?tagged=lascoloradas',
  typeMedia: 'photo',
  instagram:  {
  //Here the original object returned from the provider API if you need more data than the ones above
  }
}

Tests

npm test

Some tests will return "ERROR" due to missing api key

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright © 2017 Tekdreams. MIT Licensed.