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-api-node

v1.1.3

Published

A promised based node module to interact with the yts.mx api

Downloads

34

Readme

🌿 yts.mx API wrapper for NodeJS

A promised based node module to interact with the yts.mx/api/v2

NOTE: The YTS API is not always working as intended. I have notified YTS about some issues, to this date I did not get any reply and the issues are not fixed.

One of the issues is that the order_by and sort_by params are not working with seeds and peers. The other sort options seem to be working fine.

Another problem is that some routes are not working at all, like the movie comments and list upcomming are not working and result into a 404 not found. I have added the @deprecated flag to it, so you will be warned by your IDE when using these methods.

🪄 Installation

npm install yts-api-node

🔌 API usage

📝 Search

Usage
import { search } from 'yts-api-node';

// Search for movies with title 'The hobbit' and limit results by 50
search({ query_term: 'The hobbit', limit: 50 }).then(results => /** ... */)
Parameters

| Parameter | Required | Type | Default | Description | | ---------------- | -------- | ---------------------------------------------------------------------------------- | ---------- | -------------------------------------------------------------------- | | limit | ❌ | 1 - 50 | 20 | Limit result per page | | page | ❌ | | 1 | Used for paging | | quality | ❌ | 720p 1080p 2160p 3D all | All | Filter by quality | | minimum_rating | ❌ | 0 - 9 | 0 | Filter by minimum IMDb rating | | query_term | ❌ | string | '' | Movie Title/IMDb Code, Actor Name/IMDb Code, Director Name/IMDb Code | | genre | ❌ | string | All | Filter by genre | | sort_by | ❌ | title year rating peers seeds download_count like_count date_added | date_added | Sort result | | order_by | ❌ | asc desc | desc | Ascending or Descending order |

Response
"status": string;
"status_message": string;
"data": {
    "movie_count": number;
    "limit":number;
    "page_number": number;
    "movies": [
        {
            "id": number;
            "url": string;
            "imdb_code": string;
            "title": string;
            "title_english": string;
            "title_long": string;
            "slug": string;
            "year": number;
            "rating": number;
            "runtime": number;
            "genres": string[];
            "summary": string;
            "description_full": string;
            "synopsis": string;
            "yt_trailer_code": string;
            "language": string;
            "mpa_rating": string;
            "background_image": string;
            "background_image_original": string;
            "small_cover_image": string;
            "medium_cover_image": string;
            "large_cover_image": string;
            "state": string;,
            "torrents": [
                {
                    "url": string;
                    "hash": string;
                    "quality": string;
                    "type": string;
                    "seeds": number;
                    "peers": number;
                    "size": string;
                    "size_bytes": number;
                    "date_uploaded": string;
                    "date_uploaded_unix": number;
                },
                //...
            ]
        },
        //...
    ]
"@meta": {
    "server_time": number;
    "server_timezone": string;
    "api_version": number;
    "execution_time": string;
}

📝 Details

Usage
import { details } from 'yts-api-node';

// Can be a YTS movie ID or an IMDb ID
// This example uses an IMDb ID
details({ movie_id: 'tt2267998' }).then(results => /** ... */)
Parameters

| Parameter | Required | Type | Default | Description | | ------------- | -------- | ----------------- | ------- | ------------------------- | | movie_id | ✅ | number string | | YTS movie ID or IMDb ID | | with_images | ❌ | boolean | false | Include images in result? | | with_cast | ❌ | boolean | false | Include cast in result? |

Response
{
    "status": string;
    "status_message": string;
    "data": {
        "movie": {
            "id": number;
            "url": string;
            "imdb_code": string;
            "title": string;
            "title_english": string;
            "title_long": string;
            "slug": string;
            "year": number;
            "rating": number;
            "runtime": number;
            "genres": string[];
            "download_count": number;
            "like_count": number;
            "description_intro": string;
            "description_full": string;
            "yt_trailer_code": string;
            "language": string;
            "mpa_rating": string;
            "background_image": string;
            "background_image_original": string;
            "small_cover_image": string;
            "medium_cover_image": string;
            "large_cover_image": string;
            "torrents": [
                {
                    "url": string;
                    "hash": string;
                    "quality": string;
                    "type": string;
                    "seeds": number;
                    "peers": number;
                    "size": string;
                    "size_bytes": number;
                    "date_uploaded": string;
                    "date_uploaded_unix": number;
                },
                // ...
            ]
            "date_uploaded": string;
            "date_uploaded_unix": number;
        }
    },
    "@meta": {
        "server_time": number;
        "server_timezone": string;
        "api_version": number;
        "execution_time": string;
    }
}

📝 Suggestions

Usage
import { suggestions } from 'yts-api-node';

// Movie ID must be an YTS movie ID, IMDb ID's are not working
suggestions({ movie_id: 10 }).then(results => /** ... */)
Parameters

| Parameter | Required | Type | Default | Description | | ---------- | -------- | ----------------- | ------- | ------------ | | movie_id | ✅ | number string | | YTS movie ID |

Response
{
    "status": string;
    "status_message": string;
    "data": {
        "movie_count": number;
        "movies": [
            "id": number;
            "url": string;
            "imdb_code": string;
            "title": string;
            "title_english": string;
            "title_long": string;
            "slug": string;
            "year": number;
            "rating": number;
            "runtime": number;
            "genres": string[];
            "summary": string;
            "description_full": string;
            "synopsis": string;
            "yt_trailer_code": string;
            "language": string;
            "mpa_rating": string;
            "background_image": string;
            "background_image_original": string;
            "small_cover_image": string;
            "medium_cover_image": string;
            "state": "ok",
            "torrents": [
                {
                    "url": string;
                    "hash": string;
                    "quality": string;
                    "seeds": number;
                    "peers": number;
                    "size": string;
                    "size_bytes": number;
                    "date_uploaded": string;
                    "date_uploaded_unix": number;
                },
                // ...
            ],
            "date_uploaded": string;
            "date_uploaded_unix": number;
        ]
    },
    "@meta": {
        "server_time": number;
        "server_timezone": string;
        "api_version": number;
        "execution_time": string;
    }
}

📝 Comments (not working)

Route does not exist on yts.mx/api/v2/.

https://yts.mx/api#movie_comments

Usage
import { comments } from 'yts-api-node';

// Movie ID must be an YTS movie ID, IMDb ID's are not working
comments({ movie_id: 10 }).then(results => /** ... */)
Parameters

| Parameter | Required | Type | Default | Description | | ---------- | -------- | ----------------- | ------- | ------------ | | movie_id | ✅ | number string | | YTS movie ID |

📝 Reviews (not working)

Route does not exist on yts.mx/api/v2/.

https://yts.mx/api#movie_reviews

Usage
import { reviews } from 'yts-api-node';

// Movie ID must be an YTS movie ID, IMDb ID's are not working
reviews({ movie_id: 10 }).then(results => /** ... */)
Parameters

| Parameter | Required | Type | Default | Description | | ---------- | -------- | ----------------- | ------- | ------------ | | movie_id | ✅ | number string | | YTS movie ID |

📝 Parentals

This is apparently not implemented yet in the YTS API, returned results show

"parental_guide_text": "Parental Guide for all the movies will be republished soon. Thank you for understanding!"
Usage
import { parentals } from 'yts-api-node';

// Movie ID must be an YTS movie ID, IMDb ID's are not working
parentals({ movie_id: 10 }).then(results => /** ... */)
Parameters

| Parameter | Required | Type | Default | Description | | ---------- | -------- | ----------------- | ------- | ------------ | | movie_id | ✅ | number string | | YTS movie ID |

{
    "status": string;
    "status_message": string;
    "data": {
        "parental_guide_count": number;
        "parental_guides": [
            {
                "type": string;
                "parental_guide_text":string;
            }
        ]
    },
    "@meta": {
        "server_time": number;
        "server_timezone": string;
        "api_version": number;
        "execution_time": string;
    }
}

📝 Upcomming (not working)

Route does not exist on yts.mx/api/v2/.

https://yts.mx/api#list_upcoming

import { upcomming } from 'yts-api-node';

upcomming().then(results => /** ... */)