crunchyroll-lib
Library to get the media information about a Chrunchyroll video.
Last updated 2 years ago by jinpha .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install crunchyroll-lib 
SYNC missed versions from official npm registry.

Chrunchyroll Library

Library to get the media information about a Chrunchyroll video.

How to use in Node

This library by default will use XMLHttpRequest. This can be changed by setting the HTTP client to NodeHttpClient. Remember that this has to be done in the start of the application before anything else is done with this library.

Example

import { NodeHttpClient } from "crunchyroll-lib/services/http/NodeHttpClient";
import { setHttpClient } from "crunchyroll-lib";

// Set the Http client in the start of the application.
setHttpClient(NodeHttpClient);

Examples

Browser

import { NodeHttpClient } from "crunchyroll-lib/services/http/NodeHttpClient";
import { getMedia, setHttpClient } from "crunchyroll-lib";

const run = async () => {
  const media = await getMedia('740239', '360p', 'http://www.crunchyroll.com/boruto-naruto-next-generations/episode-17-run-sarada-740239?p360=1');
  
  const subtitles = media.getSubtitles();
  console.log("name, author, default");
  for (let i = 0; i < subtitles.length; i++)  {
    console.log(subtitles[i].getTitle() + ", " + subtitles[i].getAuthor() + ", " + (subtitles[i].isDefault() ? "true" : "false"));
  }
};

run()
.then(undefined, err => console.error(err));

Node

import { NodeHttpClient } from "crunchyroll-lib/services/http/NodeHttpClient";
import { getMedia, setHttpClient } from "crunchyroll-lib";

// Set the Http client to Node
setHttpClient(NodeHttpClient);

const run = async () => {
  const media = await getMedia('740239', '360p', 'http://www.crunchyroll.com/boruto-naruto-next-generations/episode-17-run-sarada-740239?p360=1');
  
  const subtitles = media.getSubtitles();
  console.log("name, author, default");
  for (let i = 0; i < subtitles.length; i++)  {
    console.log(subtitles[i].getTitle() + ", " + subtitles[i].getAuthor() + ", " + (subtitles[i].isDefault() ? "true" : "false"));
  }
};

run()
.then(undefined, err => console.error(err));

Current Tags

  • 1.2.2                                ...           latest (2 years ago)

19 Versions

  • 1.2.2                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.11                                ...           2 years ago
  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (11)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |