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

trakt-api

v0.4.1

Published

Trakt API v2 client

Downloads

8

Readme

Trakt.tv API v2

Node.js client for the Trakt.tv API.

Work in progress!

Installation

$ npm i trakt-api

Quick example

var Trakt = require('trakt-api');
var trakt = Trakt(API_KEY[, OPTIONS]);

// Promises...
trakt.show('manhattan', { extended : 'full' }).then(function(show) {
  console.log('%j', show);
}).catch(function(err) {
  console.warn('oh noes', err);
});

// ...or regular callbacks
trakt.show('manhattan', { extended : 'full' }, function(err, show) {
  if (err) return console.warn('oh noes', err);
  console.log('%j', show);
});

Constructor

var trakt = Trakt(API_KEY : String [, OPTIONS : Object]);

extended : String // default "extended" level (default: 'min') logLevel : String // log level (default: 'info') poolSize : Number // HTTP request pool size (default: 5) timeout : Number // HTTP timeout in ms (default: 30000) ```

API methods

Most API methods are generated from endpoints.json, although not all are implemented yet (see below). API methods generally have required and optional arguments. Required arguments are enforced and will cause an error to be thrown if not defined.

Most API methods also accept an optional OPTIONS object. There's one valid option for now:

However, this option doesn't apply to all API methods. Refer to the Trakt API documentation.

Promises versus callbacks

If you don't like promises, or just prefer old school callbacks, pass a function as last argument. Otherwise, all methods return a promise. See the example above.

Methods currently implemented

Please refer to the API documentation for more information on each method.

trakt.search(QUERY:String[, TYPE:String][, YEAR:Number][, CALLBACK])

trakt.searchAll(QUERY:String[, YEAR:Number][, CALLBACK])

trakt.searchShow(QUERY:String[, YEAR:Number][, CALLBACK])

trakt.searchMovie(QUERY:String[, YEAR:Number][, CALLBACK])

trakt.searchEpisode(QUERY:String[, YEAR:Number][, CALLBACK])

trakt.searchPerson(QUERY:String[, YEAR:Number][, CALLBACK])

trakt.calendarMyShowsNew([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.calendarMyShowsPremieres([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.calendarMyMovies([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.calendarAllShows([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.calendarAllShowsNews([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.calendarAllShowsPremieres([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.calendarAllMovies([START_DATE][, DAYS][, OPTIONS][, CALLBACK])

trakt.moviePopular([OPTIONS][, CALLBACK])

trakt.movieTrending([OPTIONS][, CALLBACK])

trakt.movieUpdates([START_DATE][, OPTIONS][, CALLBACK])

trakt.movie(ID[, OPTIONS][, CALLBACK])

trakt.movieAliases(ID[, OPTIONS][, CALLBACK])

trakt.movieReleases(ID[, COUNTRY][, OPTIONS][, CALLBACK])

trakt.movieTranslations(ID[, LANGUAGE][, OPTIONS][, CALLBACK])

trakt.movieComments(ID[, OPTIONS][, CALLBACK])

trakt.moviePeople(ID[, OPTIONS][, CALLBACK])

trakt.movieRatings(ID[, OPTIONS][, CALLBACK])

trakt.movieRelated(ID[, OPTIONS][, CALLBACK])

trakt.movieStats(ID[, OPTIONS][, CALLBACK])

trakt.movieWatching(ID[, OPTIONS][, CALLBACK])

trakt.showPopular([OPTIONS][, CALLBACK])

trakt.showTrending([OPTIONS][, CALLBACK])

trakt.showUpdates([START_DATE][, OPTIONS][, CALLBACK])

trakt.show(ID[, OPTIONS][, CALLBACK])

trakt.showAliases(ID[, OPTIONS][, CALLBACK])

trakt.showTranslations(ID[, LANGUAGE][, OPTIONS][, CALLBACK])

trakt.showComments(ID[, OPTIONS][, CALLBACK])

trakt.showProgressCollection(ID[, OPTIONS][, CALLBACK])

trakt.showProgressWatched(ID[, OPTIONS][, CALLBACK])

trakt.showPeople(ID[, OPTIONS][, CALLBACK])

trakt.showRatings(ID[, OPTIONS][, CALLBACK])

trakt.showRelated(ID[, OPTIONS][, CALLBACK])

trakt.showStats(ID[, OPTIONS][, CALLBACK])

trakt.showWatching(ID[, OPTIONS][, CALLBACK])

trakt.showSeasons(ID[, OPTIONS][, CALLBACK])

trakt.season(ID, SEASON[, OPTIONS][, CALLBACK])

trakt.seasonComments(ID, SEASON[, OPTIONS][, CALLBACK])

trakt.seasonRatings(ID, SEASON[, OPTIONS][, CALLBACK])

trakt.seasonStats(ID, SEASON[, OPTIONS][, CALLBACK])

trakt.seasonWatching(ID, SEASON[, OPTIONS][, CALLBACK])

trakt.episode(ID, SEASON, EPISODE[, OPTIONS][, CALLBACK])

trakt.episodeComments(ID, SEASON, EPISODE[, OPTIONS][, CALLBACK])

trakt.episodeRatings(ID, SEASON, EPISODE[, OPTIONS][, CALLBACK])

trakt.episodeStats(ID, SEASON, EPISODE[, OPTIONS][, CALLBACK])

trakt.episodeWatching(ID, SEASON, EPISODE[, OPTIONS][, CALLBACK])

trakt.userHistory(USERNAME[, TYPE][, ID][, CALLBACK])

trakt.userWatching(USERNAME[, CALLBACK])