Giter Site home page Giter Site logo

tmdb-js's Introduction

Node.js CI Node.js Package

An unofficial JavaScript wrapper for The Movie Database API.

npm install @david98hall/tmdb-js

Usage

Here is a simple example of how to use this wrapper:

const {TmdbClient} = require('../../../src/tmdb-js/tmdb-js');

doStuff = async function(authentication) {

   let apiKey = authentication.apiKey;
   let username = authentication.username;
   let password = authentication.password;

   let tmdb = new TmdbClient(apiKey);

   // Get movie data example
   let oceansElevenMovie = tmdb.getMovieSection().getMovie("161");
   let oceansDetails = await oceansElevenMovie.getDetailsAsync();
   let oceansImages = await oceansElevenMovie.getImagesAsync();
   console.log("A great movie: " + json.title);
   
   // Rate movie example
   let sessionId = await tmdb.getAuthenticator().createSessionAsync("chrome"); // One way of getting a session ID
   let ratingSuccessful1 = await oceansElevenMovie.rateAsync(10, sessionId);

   // Rate TV show episode example
   let loginSessionId = await tmdb.getAuthenticator().createLoginSessionAsync(username, password); // Another way of getting a session ID
   let gameOfThronesTvShow = tmdb.getTvShowSection().getTvShow("1399");
   let ratingSuccessful2 = await gameOfThronesTvShow.getEpisode(3, 9).rateAsync(10, sessionId);

   // Rate TV show as a guest example
   let guestSessionId = await tmdb.getAuthenticator().createGuestSessionAsync();
   let ratingSuccessful3 = await gameOfThronesTvShow.rateAsync(10, undefined, guestSessionId);

   // Search TMDB examples
   let searchSection = tmdb.getSearchSection();
   let searchResult1 = await searchSection.searchMoviesAsync("Ocean's");
   let searchResult2 = await searchSection.searchMoviesAsync("Ocean's", 1, 1);
   let searchResult3 = await searchSection.multiSearchAsync("Ocean's");
   let searchResult4 = await searchSection.multiSearchAsync("Ocean's", 1, 2);
}

See the documentation for more info.

tmdb-js's People

Contributors

david98hall avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.