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

myts-api

v0.2.0

Published

Get started quickly with yts api with the myts-api for JavaScript in Node.js. The SDK helps take the complexity out of coding by providing JavaScript functoins for yts services including List Movies and List Upcoming. The single, downloadable package incl

Downloads

18

Readme

myts-api

Get started quickly with yts api with the myts-api for JavaScript in Node.js. The SDK helps take the complexity out of coding by providing JavaScript functoins for yts services including List Movies and List Upcoming. The single, downloadable package includes the yts api JavaScript Library and documentation.

Highlights

  • Works on server and client
  • Jest - 🃏 Delightful JavaScript Testing
  • Log generator
  • YTS API
  • axios as a Promise based HTTP client for the browser and node.js
  • No axios unit jest test (next release)

Install

Inside your project folder do:

npm i -S myts-api

Usage

NodeJS

Simply require the module myts-api

const MytsApi = require('myts-api').API;
const myts = new MytsApi();


// myts fields
/*
baseUrl: string;      // Yts api base url, for endpoints GET request
qualities: any;       // Yts moveis qualities object - [HD,FULL HD, 3D]
sortBy: any;          // query sort object - [title,year,rating,peers,seeds,download_count, like_count, date_added], default: date_added
orderBy: any;         // query order object - [asc,desc], default: desc
endpoints: any;       // Yts Api Endpoints which provides an easy way to access the YTS website
trackers: any;   // YTS, torrents recommend trackers
*/

Functions

This functions makes HTTP GET call using axios, and return an Promise, with the response or throw and error.

List Movies

For list movies action, call listMovies(params:not required), where params is the search condition (please check the YTS API List Movies parameters table at the bottom ), returning the result empty list, or a list of movies object.

myts.listMovies()
  .then((movies)=>{
    console.log("Movies: ",movies)
  })
  .catch(err=>{
      console.log("Error: ",err)
  })

Movie Details

For movies details action, call movieDetails(params:{movie_id:int} required), where params is an object with required movie_id and others (please check the YTS API Movie Details parameters table at the bottom ), returning the result empty object, or the result movie detail object.

myts.movieDetails({movie_id:8553})
  .then((movie)=>{
    console.log("Movie: ",movie)
  })
  .catch(err=>{
      console.log("Error: ",err)
  })

YTS API

Endpoints

List Movies

list_movies - Used to list and search through out all the available movies. Can sort, filter, search and order the results.

Example: https://yts.am/api/v2/list_movies.json?quality=3D

Parameters

|Parameter|Required|Type|Default|Description| |--- |--- |--- |--- |--- | |limit|False|Integer between 1 - 50 (inclusive)|20|The limit of results per page that has been set| |page|False|Integer (Unsigned)|1|Used to see the next page of movies, eg limit=15 and page=2 will show you movies 15-30| |quality|False|String (720p, 1080p, 3D)|All|Used to filter by a given quality| |minimum_rating|False|Integer between 0 - 9 (inclusive)|0|Used to filter movie by a given minimum IMDb rating| |query_term|False|String|0|Used for movie search, matching on: Movie Title/IMDb Code, Actor Name/IMDb Code, Director Name/IMDb Code| |genre|False|String|All|Used to filter by a given genre (See http://www.imdb.com/genre/ for full list)| |sort_by|False|String (title, year, rating, peers, seeds, download_count, like_count, date_added)|date_added|Sorts the results by choosen value| |order_by|False|String (desc, asc)|desc|Orders the results by either Ascending or Descending order| |with_rt_ratings|False|Boolean|false|Returns the list with the Rotten Tomatoes rating included|

Movie Details

movie_details - Returns the information about a specific movie.

Example:https://yts.am/api/v2/movie_details.json?movie_id=15&with_images=true&with_cast=true

Parameters

|Parameter|Required|Type|Default|Description| |--- |--- |--- |--- |--- | |movie_id|True|Integer (Unsigned)|null|The ID of the movie| |with_images|False|Boolean|false|When set the data returned will include the added image URLs| |with_cast|False|Boolean|false|When set the data returned will include the added information about the cast|

List Upcoming

list_upcoming - Returns the 4 latest upcoming movies.

Example: https://yts.am/api/v2/list_upcoming.json

changelogs for this project