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

yts

v2.0.1

Published

Node.js promise-based library for interacting with the YTS YIFY movies API.

Downloads

13,615

Readme

YTS

Node.js promise-based library for interacting with the YTS YIFY movies API.

Installation

Install via npm.

npm i yts

Require yts in your project.

const yts = require("yts");

Usage

List movies

List the 20 most recently added movies.

const main = async () => {
  const res = await yts.listMovies();
}

The result will look like this:

{
  "movie_count": 25489,
  "limit": 20,
  "page_number": 1,
  "movies": [
    {
      "id": 00000,
      "url": "yts.mx URL",
      "imdb_code": "tt0000000",
      "title": "Movie Title",
      "title_english": "Movie Title in English",
      "title_long": "Movie Title (2021)",
      "slug": "movie-title-2021",
      "year": 2021,
      "rating": 0,
      "runtime": 0,
      "genres": [
        "Array of genre strings"
      ],
      "summary": "Movie summary",
      "description_full": "Movie description",
      "synopsis": "Movie synopsis",
      "yt_trailer_code": "YouTube video ID for trailer",
      "language": "en",
      "mpa_rating": "",
      "background_image": "yts.mx URL for background image JPG",
      "background_image_original": "yts.mx URL for background image JPG",
      "small_cover_image": "yts.mx URL for cover image JPG",
      "medium_cover_image": "yts.mx URL for cover image JPG",
      "large_cover_image": "yts.mx URL for cover image JPG",
      "state": "ok",
      "torrents": [
        {
          "url": "yts.mx torrent URL",
          "hash": "torrent hash",
          "quality": "720p",
          "type": "web",
          "seeds": 0,
          "peers": 0,
          "size": "1.00 MB",
          "size_bytes": 1000000,
          "date_uploaded": "2021-01-14 13:29:52",
          "date_uploaded_unix": 1610627392,
          "magnet_url: "magnet:url for torrent"
        },{
          // Possibly more torrent files for various qualities
        }
      ],
      "date_uploaded": "2021-01-14 13:29:52",
      "date_uploaded_unix": 1610627392
    },
    {
      // More movies
    }
  ]
}

Narrow the list with parameters

const main = async () => {
  const res = await yts.listMovies({ limit: 10, query_term: "Avengers" });
}

There are other parameters to use with listMovies(). Full documentation can be found at https://yts.mx/api#list_movies

Get movie details

First get the movie's YTS ID. You might get this from listMovies(). Then call movieDetails().

const main = async () => {
  const res = await yts.movieDetails({ movie_id: 0000 });
}

The result will look like this:

{
  "movie": {
    "id": 0000,
    "url": "yts.mx URL",
    "imdb_code": "tt0000000",
    "title": "Movie Title",
    "title_english": "Movie Title in English",
    "title_long": "Movie Title (2021)",
    "slug": "movie-title-2021",
    "year": 2021,
    "rating": 0,
    "runtime": 0,
    "genres": [
      "Array of genre strings"
    ],
    "download_count": 0,
    "like_count": 0,
    "description_intro": "First part of description",
    "description_full": "Full description of movie",
    "yt_trailer_code": "YouTube video ID for trailer",
    "language": "en",
    "mpa_rating": "",
    "background_image": "yts.mx JPG URL",
    "background_image_original": "yts.mx JPG URL",
    "small_cover_image": "yts.mx JPG URL",
    "medium_cover_image": "yts.mx JPG URL",
    "large_cover_image": "yts.mx JPG URL",
    "torrents": [
      {
        "url": "yts.mx torrent URL",
          "hash": "torrent hash",
          "quality": "720p",
          "type": "web",
          "seeds": 0,
          "peers": 0,
          "size": "1.00 MB",
          "size_bytes": 1000000,
          "date_uploaded": "2021-01-14 13:29:52",
          "date_uploaded_unix": 1610627392,
          "magnet_url: "magnet:url for torrent"
      },
      {
        // Possibly more torrent files for various qualities
      },
    ],
    "date_uploaded": "2021-01-14 13:29:52",
    "date_uploaded_unix": 1610627392
  }
}

Tests

Full tests are available for this library and the YTS API.

npm test

Note that this will invoke quite a few simultaneous HTTP requests to the YTS API.

To Do

  • Comments, parental guides, reviews, upcoming movie list, and user details: These features are described in the YTS API documentation. However, they either return 404s or messages stating that they will be reublished soon.
  • Getting a user key (logging a user in), registering user, issuing forgot password email, resetting a password: These features require an application key which is only provided by contacting them
  • Getting a user profile: requires a user key which is only available by using the API to get a user key (see bullet point above)
  • Editing user settings, liking a movie, adding/getting/deleting bookmarks, making/liking/reporting/deleting comments, and making requests: These features require an application key and a user key

License

The MIT License

Copyright 2022 Travis Horn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.