1.2.0 • Published 6 years ago

jwplayer-scraper v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

jwplayer-scraper

This module helps you get the source URLs of the media that is added to the JW Player in the page/iframes using node.js

Installation

This module can be installed via npm:

$ npm install --save jwplayer-scraper

Usage

var scraper = require("jwplayer-scraper");

Functions

scraper.getMediaSources(URL, options)

  • URL: URL of the page that needs to be scraped
  • options (optional): For now, this can only contain an object with the 'jwplayerFilename' key. If it's not set, it will try to automatically locate the jwplayer.js file. (This is experimental)
var scraper = require("jwplayer-scraper");

(async function() {
  var sources = await scraper.getMediaSources(
    "https://<URL_OF_THE_WEBSITE>/<PATH_TO_THE_PAGE>",
    {
      jwplayerFilename: "jwplayer.6.11.js"
    }
  );

  console.log(sources);
})();

or if you want to use it with .then() instead of async/await:

var scraper = require("jwplayer-scraper");

scraper
  .getMediaSources("https://<URL_OF_THE_WEBSITE>/<PATH_TO_THE_PAGE>")
  .then(sources => {
    console.log(sources);
  });