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

metagetta

v0.4.1

Published

Library for fetching content metadata from around the web.

Downloads

5

Readme

metagetta

Metagetta is a library for fetching content metadata from around the web. Supported sources include:

API

metagetta(uri, [options])

uri should be a valid URI from any of the supported sources. For example, a YouTube URI (https://www.youtube.com/watch?v=fPDYj3IMkRI), a Vimeo URI (https://vimeo.com/135288462), a Dailymotion URI (http://www.dailymotion.com/video/x30f1ti_the-iced-beverage-rap_fun), a VAST tag (http://ad3.liverail.com/?LR_PUBLISHER_ID=1331&LR_CAMPAIGN_ID=229&LR_SCHEMA=vast2.), an Instagram URI (https://instagram.com/p/6DD1crjvG7/), a Wistia URI (https://cinema6.wistia.com/medias/9iqvphjp4u), a JWPlayer URI (https://content.jwplatform.com/previews/iGznZrKK-n5DiyUyn), or a Vzaar URI (http://vzaar.tv/5700429) uri can also be an Array of URIs (to batch calls.)

options (optional) should be an object containing configuration options.

A Promise is returned that will be fulfilled with the content's metadata.

metagetta(options)

options should be an object containing configuration options. It can also be an Array of options (to batch calls.)

A Promise is returned that will be fulfilled with the content's metadata.

metagetta.withConfig(options)

This method will return a new instance of metagetta() that is pre-configured with the specified options.

Options

The following configuration options are valid:

  • uri: A URI from any of the supported sources.
  • type: The name of a source. Supported sources are youtube, vimeo, dailymotion, vast, instagram, or wistia.
  • id: The ID of a piece of content. This does not apply to VAST videos.
  • fields: An Array of the only response fields that should be included. This is useful as it can potentially reduce the amount of YouTube quota units metagetta consumes.
  • youtube.key: A YouTube API Key (required to make calls against YouTube's Data API.)
  • instagram.key: An Instagram API Client Key (required to make calls against Instagram's API)
  • wistia.key: A Wistia API Password (required to make calls against Wistia's API)
  • jwplayer.key: A JWPlayer API Key (required to make calls against JWPlayer's API)
  • jwplayer.secret: A JWPlayer API Secret (also required to make calls against JWPlayer's API)
  • facebook.key: A Facebook Application id (required to make calls against Facebook's API)
  • facebook.secret: A Facebook Application secret (also required to make calls against Facebook's API)

Response

The following response object will be provided no matter the source of the content:

  • type: The source of the content
  • id: The unique ID of the content
  • uri: The URI for the content
  • title: The name of the content
  • description: A description of the content
  • duration: The duration (in seconds) of the content
  • hd: A Boolean indicating if the content is HD or not; for VAST, the highest-quality media file will be used
  • tags: An Array of video tags
  • publishedTime: A Date representing when the content was published/created
  • views: The number of views the video has (likes in the case of Instagram)
  • thumbnails.small: Url of a small thumbnail
  • thumbnails.large: Url of a large thumbnail

Example

var metagetta = require('metagetta').withConfig({
  youtube: { key: 'f4938yrt83497ryf48975fh348957f4389' }
});

metagetta([
  'https://www.youtube.com/watch?v=fPDYj3IMkRI',
  'https://vimeo.com/135288462',
  'http://www.dailymotion.com/video/x30f1ti_the-iced-beverage-rap_fun',
  'http://ad3.liverail.com/?LR_PUBLISHER_ID=1331&LR_CAMPAIGN_ID=229&LR_SCHEMA=vast2',
  'https://instagram.com/p/6DD1crjvG7/'
]).then(function(videos) {
  videos.forEach(function(video) {
    console.log(video.title + ' is ' + video.duration + ' seconds!');
  });
}).catch(function(error) {
  console.error('There was a problem: ' + error);
});

Notes

  • As of now, JWPlayer metadata will not be retrievable in a browser environment