metainfo

Get meta information from different APIs.

npm install metainfo
4 downloads in the last week
7 downloads in the last month

MetaInfo (v0.2.15)

This project was renamed from "VidInfo".

Install: npm install metainfo

This project is Unlicensed. In other words, I don't care what you do with it. However, if you make something interesting, I would like to check it out.

Build Status Bitdeli Badge

Video APIs:

animoto.com anyclip.com (6) archive.org bambuser.com (1) blip.tv collegehumor.com comedycentral.com (6) coub.com crackle.com (6) dailymotion.com dotsub.com facebook.com (1,3) flickr.com (1) funnyordie.com giantbomb.com (1,2) qik.com hulu.com imdb.com (2,3) jest.com justin.tv (2) liveleak.com (6) mag.ma (5) mefeedia.com (6) mixbit.com (6) nfb.ca on.aol.com qik.com revision3.com screenr.com snotr.com (6) socialcam.com (6) ted.com themoviedb.org (1) theonion.com (6) trailers.apple.com (1) trakt.tv (1,2,3) twitch.tv (2) ustream.tv (2) viddler.com videojug.com videolog.tv vimeo.com vine.co (6) vzaar.com webcams.travel (1) wistia.com (4) yahoo.com (6) youtube.com

1) API key required. See "bambuser" example at the bottom.
2) This method is BETA.
3) More information available. See "More Information" below.
4) Requires basic auth (username:password). See "wista" example at the bottom.
5) Located in "./apis/obsolete/" due to API changes, removals, or extended down time.
   Just because it's located in obsolete does not mean a replacement hasn't been created.
6) Requires an embed.ly API key.

Audio APis:

mixcloud.com official.fm soundcloud.com spotify.com

Image APIs:

23hq.com deviantart.com

Misc APIs:

gist.github.com (1) github.com (1) ifixit.com npmjs.org slideshare.net travis-ci.org (2)

1) Need to add API key support.
2) More information available. See "More Information" below.

Embed.ly API:

WARNING: Do NOT enable embedly (./apis/embedly.js) with any other APIs!

Embedly is a HUGE oEmbed provider and as such supports some of the APIs already in use.
Because of this there are conflicts. To generate the embedly.js file, see functions below.
After you run the embedly generator, a new file will be created at: ./apis/embedly.js
Embedly is too massive to display what websites it supports, so you'll have to read embedly.js yourself
or check the embed.ly providers list here: http://embed.ly/embed/features/providers

Services URL: http://api.embed.ly/1/services
API key required, signup here: https://app.embed.ly/signup/

Experimental APIs:

metacafe.com movieclips.com muzu.tv (1) traileraddict.com

1) API key required. See "bambuser" example at the bottom.

NOTE: These now require xml2json. (https://npmjs.org/package/xml2json)

More Information:

(imdb.com)
    IMDB does not have an API so use of a 3rd party API is required.
    Please see http://www.omdbapi.com/ for more information.
(facebook.com)
    Facebook requires an access token to be generated. The generator makes an access token
    that lasts for 60 days. You can revisit the generator to find out when your token will expire.
    I will look for a better method later on, but for now this is how it has to be.
    Generator: http://louist.github.io/MetaInfo/accessToken.html
(trakt.tv)
    This API is massive and can return a lot of information. I need to rewrite parts of MetaInfo to support this.
    For now, extended summary for Movies and TV shows are supported.
(travis-ci.org)
    There are many metadata methods this API supports, right now I've only done builds and jobs. I'm not at all sure
    when or if I'll ever add support for any of the other methods.
    When using a shortcut, the ID must be passed as "builds/<number>" or "jobs/<number>". (Examples: builds/18234463, jobs/18234467)

TODO:

  • [ ] Find more API's to use. -- Please suggest some. (This should never be finished!)
  • [ ] Create tests. (Started, need to figure out async with assert. "npm test")
  • [ ] Improve basic auth and API key support.
  • [ ] Make a better facebook access token generator.
    (http://louist.github.io/MetaInfo/accessToken.html)
    
  • [ ] Add support for more API features besides summaries.
    NOTE: I might just make multiple API files because this could be complicated...
          -- I've done this already for places like ustream.tv and and justin.tv -- We'll see what happens!
    
  • [x] Document things better... This README is a mess! (Did I do this?)

Options:

apikey - The API key, when needed.
basicauth - Your basic auth `username:password`, when needed.
formatter - The formatter to use on your JSON data. See ./examples/youtubecom.js

(detectAll options)
nocheck - Return information on a video more than once if found multiple times. See ./examples/detectAll.js
keys -  An object with API keys.
Example: {keys:{bambuser:'EXAMPLE-KEY',themoviedb:'ANOTHER-KEY'},nocheck:true}

Settings:

format - Use the formatter, true or false.
enabled - Path to enabled API configs. -- Default: ./apis/enabled/
disabled - Path to disabled API configs. -- Default: ./apis/disabled/

Settings usage:

var MetaInfo = require('metainfo')({format:true});

Shortcuts:

23hq.com:                   23hq, 23hqcom
Archive.org:                arch, archive, archiveorg
Animoto.com:                ani, animoto, animotocom
Anyclip.com:                aclip, anyclip, anyclipcom
Bambuser.com:               bam, bambuser, bambusercom
Blip.tv:                    blip, bliptv
Collegehumor.com*:          chumor, college, collegehumor, collegehumorcom
Comedycentral.com:          comcen, comedycentral, comedycentralcom
Coub.com:                   coub, coubcom
Crackle.com:                crackle, cracklecom
Dailymotion.com:            dmo, dailymo, dailymotion, dailymotioncom
Deviantart.com:             dart, deviant, deviantart, deviantartcom
Dotsub.com:                 dotsub, dotsubcom
Facebook.com:               fbook, fbvideo, facebook, facebookcom
Flickr.com:                 flickr, flickrcom
Funnyordie.com:             ford, funnyor, funnyordie, funnyordiecom
GiantBomb.com:              gbomb, giantbomb, giantbombcom
Gist.github.com:            gist, gistgithub, gistgithubcom
Github.com:                 git, github, githubcom
Hulu.com:                   hulu, hulucom
iFixit.com:                 ifixit, ifixitcom
IMDB.com:                   imdb, imdbcom
Jest.com:                   jest, jestcom
Justin.tv (stream):         jtvs, jstream, justintvstream
Justin.tv (video clip):     jtvc, jclip, justintvclip
Liveleak.com:               lleak, liveleak, liveleakcom
Mag.ma:                     mag, magma
Mefeedia.com:               mefee, mefeedia, mefeediacom
Metacafe.com*:              meta, mcafe, metacafe, metacafecom
MixBit.com:                 mix, mixbit, mixbitcom
Mixcloud.com:               mixc, mixcloud, mixcloudcom
Movieclips.com*:            mclips, movieclips, movieclipscom
Muzu.tv*:                   muzu, muzutv
Nfb.ca:                     nfb, nfbca
Npmjs.org:                  npm, npmjs, npmjsorg
Official.fm:                ofm, official, officialfm
on.aol.com:                 onaol, onaolcom
Qik.com:                    qik, qikcom
Revision3.com:              revis, revision3, revision3com
Screenr.com:                scrn, screenr, screenercom
Slideshare.net:             sshare, slideshare, slidesharenet
Snotr.com:                  snotr, snotrcom
Socialcam.com:              scam, socialcam, socialcamcom
Soundcloud.com:             sndcdn, soundcloud, soundcloudcom
Spotify.com:                spotify, spotifycom
Ted.com:                    ted, tedcom
Themoviedb.org:             tdb, tmdb, themoviedborg
Theonion.com:               onion, theonion, theonioncom
Traileraddict.com*:         tadd, taddict, traileraddict, traileraddictcom
Trailers.apple.com:         tapple, trailersapple, trailersapplecom
Trakt.tv (show/movie):      trakt, trakttv
Travis-ci.org:              travis, travisci, travisciorg
Twitch.tv (stream):         ttvs, tstream, twitchtvstream
Twitch.tv (video clip):     ttvc, tclip, twitchtvclip
Ustream.tv (stream):        utvs, ustream, ustreamtvstream
Ustream.tv (video clip):    utvc, uclip, ustreamtvclip
Viddler.com:                vidd, viddler, viddlercom
Videojug.com:               vjug, videojug, videojugcom
Videolog.tv:                vlog, videolog, videologtv
Vimeo.com:                  vimeo, vimeocom
Vine.co:                    vine, vineco
Vzaar.com:                  vzaar, vzaarcom
Webcams.travel:             wct, webtra, wtravel, webcamstravel
Wistia.com:                 wistia, wistacom
Yahoo.com:                  yahoo, yvideo, yahoocom
YouTube.com:                yt, youtube, youtubecom

*  See "Experimental APIs" above.

Examples:
    MetaInfo.youtube('ZRAr354usf8',console.log);
    MetaInfo.yt('ZRAr354usf8',console.log); // YouTube
    MetaInfo.dmo('xycczk',console.log); // Dailymotion

Functions:

MetaInfo.detect(url[,callback[,options]]) - Parse a URL and create an object used for 'byURL'.
     See ./examples/detect.js

MetaInfo.detectAll(string[,callback[,options]]) - Parse a string and return an object with all the IDs.
     Options: keys - The list of keys for APIs that might need them.
              nocheck - Return information on a video more than once if found multiple times.
              Example: {keys:{bambuser:'EXAMPLE-KEY',themoviedb:'ANOTHER-KEY'},nocheck:true}
     See ./examples/detectAll.js

MetaInfo.byID(id,api,callback[,options]) - Connects to the (should be) correct API for video information.
     See ./examples/byid.js - Changed from "byid" for standardization.

MetaInfo.byURL(url,callback[,options]) - Connects to the (should be) correct API for video information.
     See ./examples/byurl.js - Changed from "byurl" for standardization.

MetaInfo.<apiname>(id,callback[,options]) -- Shortcut for 'byID'.
     See ./examples/byapi.js

MetaInfo.getAPILocation(apiname) - Get the location of an API config file. The "apiname" is the full name, such as "youtubecom."
     Returns: {is:<true/false>,path:<location>,file:<filename>} -- "is" is in enabled (true) or disabled (false) folder.

MetaInfo.enable(apiname[,nomove]) - Enable an API. The "apiname" is the full name, such as "youtubecom."
     NOTE: Moves <apiname> from ./apis/disabled/ to ./apis/enabled/ unless "nomove" is true.

MetaInfo.disable(apiname[,nomove]) - Disable an API. The "apiname" is the full name, such as "youtubecom."
     NOTE: Moves <apiname> from ./apis/enabled/ to ./apis/disabled/ unless "nomove" is true.   

MetaInfo.genEmbedly([callback[,services url]]) - Generate/update the embedly.js config from the services url.
      Services url: http://api.embed.ly/1/services
      Callback arguments: {message:<string>,location:<string>,success:<boolean>}

Example Usage - Look in "examples" folder for more examples.

var MetaInfo = require('MetaInfo')({format:true});

// YouTube -- Only return the title and published date, using 'formatter'.
MetaInfo.byURL('http://www.youtube.com/watch?v=ZRAr354usf8',console.log,{formatter: function (data,cb) {
       var ret = {};
       if ('$t' in data.entry.title) {
          ret.title = data.entry.title.$t;
          if ('$t' in data.entry.published) {
             ret.published = new Date(Date.parse(data.entry.published.$t));
          }
       };
       cb(ret);
}});

// YouTube by video ID.
MetaInfo.byID('ZRAr354usf8','youtube',console.log,{formatter: function (data,cb) {
       var ret = {};
       if ('$t' in data.entry.title) {
          ret.title = data.entry.title.$t;
          if ('$t' in data.entry.published) {
             ret.published = new Date(Date.parse(data.entry.published.$t));
          }
       };
       cb(ret);
}});

// 'byID' shortcut.
MetaInfo.vimeo('61969130',console.log);
MetaInfo.youtube('ZRAr354usf8',console.log);
MetaInfo.yt('ZRAr354usf8',console.log); // YouTube
MetaInfo.trakt(["show","under-the-dome"],console.log); // Trakt.tv

// Bambuser (API Key required)
MetaInfo.byURL('http://bambuser.com/v/3453034',function (obj) {
       console.log(obj);
},{apikey:'APIKEY'});

// Wista (Basic auth required)
MetaInfo.byURL('http://ltdev.wistia.com/medias/piywx9v8rr',function (obj,e) {
   if (!e) {
      console.log('(byapi) wista: '+JSON.stringify(obj)+'\n\n');
    } else {
      console.log('(byapi - ERROR) wista: '+JSON.stringify({error:true,message:obj})+'\n\n');
   }
},{basicauth:'USERNAME:PASSWORD'});

// Facebook (requires access token - http://louist.github.io/MetaInfo/accessToken.html)
MetaInfo.byURL('https://www.facebook.com/photo.php?v=10101580633888836&set=vb.225034700870481&type=3&theater',function (obj) {
   console.log(JSON.stringify(obj)+'\n\n');
},{apikey:'ACCESS TOKEN'});

// Trakt "byID", must pass an array. ["{:method}","{:id}"] -- Method is show or movie.
// See http://trakt.tv/api-docs/ for more information.
MetaInfo.byID(["movie","after-earth-2013"],"trakt",function (obj) {
   console.log(JSON.stringify(obj)+'\n\n');
},{apikey:"APIKEY"})
MetaInfo.byID(["show","under-the-dome"],"trakt",function (obj) { 
   console.log(JSON.stringify(obj)+'\n\n');
},{apikey:"APIKEY"})

// 'detect' example. -- Prints video ID and API link in an object.
console.log(MetaInfo.detect('http://www.youtube.com/watch?v=ZRAr354usf8'));

// 'detectAll' example. Prints an object with multiple 'detect' objects.
console.log(MetaInfo.detectAll('http://www.youtube.com/watch?v=ZRAr354usf8 http://bambuser.com/v/3453034 http://ltdev.wistia.com/medias/piywx9v8rr http://flic.kr/p/e9964e'));
npm loves you