Socket
Socket
Sign inDemoInstall

tmdb-js-wrapper

Package Overview
Dependencies
72
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tmdb-js-wrapper

A JavaScript wrapper package for The Movie Database API.


Version published
Weekly downloads
37
decreased by-22.92%
Maintainers
1
Install size
4.85 MB
Created
Weekly downloads
 

Readme

Source

tmdb-js

Node.js CI

https://github.com/david98hall/tmdb-js/actions/workflows/node.js.yml/badge.svg

An unofficial JavaScript wrapper for The Movie Database API.

Installation

npm install tmdb-js-wrapper
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: " + oceansDetails.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.

Keywords

FAQs

Last updated on 20 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc