Git Product home page Git Product logo

yts-api-pt's Introduction

yts-api-pt

Build Status Coverage Status Dependency Status devDependency Status

A NodeJS wrapper for yts.ag.

Usage

Setup

npm install --save yts-api-pt

Initialize

const YtsApi = require('eztv-api-pt')

// Create a new instance of the module.
const yts = new YtsApi({
  baseUrl // The base url of yts. Defaults to 'https://yts.ag/'.
})

Example usage

getMovies:

yts.getMovies({
  limit: 20,
  page: 1,
  quality: 'All',
  minimumRating: 0,
  queryTerm: 'inception',
  genre: 'action',
  sortBy: 'date_added',
  orderBy: 'desc',
  withRtRatings: true
})

getMovie:

yts.getMovie({
  movieId: 15,
  withImages: true,
  withCast: true
}).then(res => console.log(res))
  .catch(err => console.error(err))

getSuggestions:

yts.getSuggestions(15)
  .then(res => console.log(res))
  .catch(err => console.error(err))

getParentalGuides:

yts.getParentalGuides(15)
  .then(res => console.log(res))
  .catch(err => console.error(err))

Output

getMovies:

{
  "status": "ok",
  "status_message": "Query was successful",
  "data": {
    "movie_count": 1,
    "limit": 20,
    "page_number": 1,
    "movies": [<movies>]
  },
  "@meta": {
    "server_time": 1487195100,
    "server_timezone": "EST5EDT",
    "api_version": 2,
    "execution_time": "0 ms"
  }
}

getMovie:

{
  "status": "ok",
  "status_message": "Query was successful",
  "data": {
    "movie": <movie>
  },
  "@meta": {
    "server_time": 1487195033,
    "server_timezone": "EST5EDT",
    "api_version": 2,
    "execution_time": "0.01 ms"
  }
}

getSuggestions:

{
  "status": "ok",
  "status_message": "Query was successful",
  "data": {
    "movie_count": 4,
    "movies": [<movies>]
  },
  "@meta": {
    "server_time": 1487194963,
    "server_timezone": "EST5EDT",
    "api_version": 2,
    "execution_time": "0 ms"
  }
}

getParentalGuides:

{
  "status": "ok",
  "status_message": "Query was successful",
  "data": {
    "parental_guide_count": 1,
    "parental_guides": [{
      "type": "Info",
      "parental_guide_text": "Parental Guide for all the movies will be republished soon. Thank you for understanding!"
    }]
  },
  "@meta": {
    "server_time": 1487194752,
    "server_timezone": "EST5EDT",
    "api_version": 2,
    "execution_time": "0 ms"
  }
}

Movie Example:

{
  "id": 1606,
  "url": "https://yts.ag/movie/inception-2010",
  "imdb_code": "tt1375666",
  "title": "Inception",
  "title_english": "Inception",
  "title_long": "Inception (2010)",
  "slug": "inception-2010",
  "year": 2010,
  "rating": 8.8,
  "runtime": 148,
  "genres": [
    "Action",
    "Adventure",
    "Crime",
    "Mystery",
    "Sci-Fi",
    "Thriller"
  ],
  "summary": "",
  "description_full": "",
  "synopsis": "",
  "yt_trailer_code": "YoHD9XEInc0",
  "language": "English",
  "mpa_rating": "PG-13",
  "background_image": "https://yts.ag/assets/images/movies/Inception_2010/background.jpg",
  "background_image_original": "https://yts.ag/assets/images/movies/Inception_2010/background.jpg",
  "small_cover_image": "https://yts.ag/assets/images/movies/Inception_2010/small-cover.jpg",
  "medium_cover_image": "https://yts.ag/assets/images/movies/Inception_2010/medium-cover.jpg",
  "large_cover_image": "https://yts.ag/assets/images/movies/Inception_2010/large-cover.jpg",
  "state": "ok",
  "torrents": [{
    "url": "",
    "hash": "",
    "quality": "720p",
    "seeds": 634,
    "peers": 108,
    "size": "1.07 GB",
    "size_bytes": 1148903752,
    "date_uploaded": "2015-11-01 00:14:37",
    "date_uploaded_unix": 1446351277
  }],
  "date_uploaded": "2015-11-01 00:14:37",
  "date_uploaded_unix": 1446351277
}

Testing

You can run tests with the following npm command:

 $ npm test

License

MIT License

yts-api-pt's People

Contributors

chrisalderson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.