1.1.3 • Published 2 years ago

yts-api-node v1.1.3

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

🌿 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
ParameterRequiredTypeDefaultDescription
limit1 - 5020Limit result per page
page1Used for paging
quality720p 1080p 2160p 3D allAllFilter by quality
minimum_rating0 - 90Filter by minimum IMDb rating
query_termstring''Movie Title/IMDb Code, Actor Name/IMDb Code, Director Name/IMDb Code
genrestringAllFilter by genre
sort_bytitle year rating peers seeds download_count like_count date_addeddate_addedSort result
order_byasc descdescAscending 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
ParameterRequiredTypeDefaultDescription
movie_idnumber stringYTS movie ID or IMDb ID
with_imagesbooleanfalseInclude images in result?
with_castbooleanfalseInclude 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
ParameterRequiredTypeDefaultDescription
movie_idnumber stringYTS 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
ParameterRequiredTypeDefaultDescription
movie_idnumber stringYTS 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
ParameterRequiredTypeDefaultDescription
movie_idnumber stringYTS 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
ParameterRequiredTypeDefaultDescription
movie_idnumber stringYTS 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 => /** ... */)
1.1.3

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago