UNPKG

crunchy

Version:

Crunchy is a fork of Crunchyroll.js, capable of downloading anime episodes from the popular CrunchyRoll streaming service.

60 lines 1.94 kB
'use strict'; exports.__esModule = true; exports["default"] = { getMedia: getMedia }; function getMedia(vlosScript, seasonTitle, seasonNumber) { var vlosMedia; function f(script) { /* We need to scope things */ /* This is what will give us the medias */ function VilosPlayer() { this.load = function (a, b, c) { vlosMedia = this.config.media; vlosMedia.series = this.config.analytics.media_reporting_parent; }; this.config = {}; this.config.player = {}; this.config.player.pause_screen = {}; this.config.language = ''; } /* Let's stub what the script need */ var window = { WM: { UserConsent: { getUserConsentAdvertisingState: function () { return ''; } } } }; var document = { getElementsByClassName: function (a) { return { length: 0 }; } }; var localStorage = { getItem: function (a) { return null; } }; var $ = { cookie: function (a) { } }; /* Evil ugly things. Need to run the script from a somewhat untrusted source. Need to find a better way of doing. */ // tslint:disable-next-line:no-eval eval(script); } f(vlosScript); if (vlosMedia === undefined) { console.error('Error fetching vlos data - aborting - Please report the error if happen again.'); process.exit(-1); } return { episode: vlosMedia.metadata.episode_number, id: vlosMedia.metadata.id, series: vlosMedia.series.title, season: seasonTitle, title: vlosMedia.metadata.title, swf: '', volume: seasonNumber, filename: '', media: vlosMedia }; } //# sourceMappingURL=vlos.js.map