Skip to content

MarketingPipeline/TheMovieDB-API-Wrapper.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TheMovieDB-API-Wrapper.js

A easy to use, pure vanilla JavaScript API wrapper for TheMovieDB
Show your support!

A JavaScript library for easily fetching ALL info about movies / tv including (genres & actors) & more via TheMovieDB API. With support for finding media info for torrent names via Torrent Name Parser.

Example usage


How to use TheMovieDB-API-Wrapper.js:

⚠️ Error Handling: Any errors that occur will be returned inside a JSON key named tmdb_api_error


How to search up Movie info:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

A movie / film query name could look like the following example(s)

Captain America
Captain America (2014)
Captain America The Winter Soldier (2014) 1080p BrRip x264 - YIFY

for more accurate results, a year should be provided in the query.

Usage

When searching up a movie / film - any found media info & actor info will be returned in seperated lists inside of a array.

Paramaters (Query [REQUIRED], Type [REQUIRED], Max Actors)

 /// API WRAPPER USAGE EXAMPLE	
 
 import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
	
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")

// Auto detecting name & year # from Torrent Name
fetch_tmdb_info("Captain America The Winter Soldier (2014) 1080p BrRip x264 - YIFY", "movie",  2).then(function(search_results) {
    console.log(search_results)
  });
  
	
/// Both arrays (Media Info & Actors Info)
fetch_tmdb_info("Captain America The Winter Soldier", "movie",  2).then(function(search_results) {
    console.log(search_results)
  });
  
/// Media Info Only
fetch_tmdb_info("8 Mile (2002)", "movie",  2).then(function(search_results) {
    console.log(search_results)[0]
  });  
  
/// Actor / Cast Info Only
fetch_tmdb_info("8 Mile", "movie",  2).then(function(search_results) {
    console.log(search_results)[1]
  });    

Options

Parameters Meaning Default Required
query The movie you would to search info for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode. undefined Yes
max_actors The maximum number of actor / cast members to return data for 5 No













How to search up TV Show info:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

Usage

When searching up a TV show - any found media info & actor info will be returned in seperated lists inside of a array.

A TV show query name could look like the following example(s)

Two and a Half Men
Two and a Half Men (2003)
Two.and.a.Half.Men.S05E02.720p.HDTV.x264-KILLERS[rartv]

for more accurate results, a year should be provided in the query.

Paramaters (Query [REQUIRED], Type [REQUIRED], Max Actors)

  /// API WRAPPER USAGE EXAMPLE		
  
  import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
  
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")	
	
// Auto detecting name & year # from Torrent Name
fetch_tmdb_info("Two.and.a.Half.Men.S05E02.720p.HDTV.x264-KILLERS[rartv]", "movie",  2).then(function(search_results) {
    console.log(search_results)
  });
  
	
/// Both arrays (Media Info & Actors Info)
fetch_tmdb_info("Two and a Half Men", "tv",  2).then(function(search_results) {
    console.log(search_results)
  });
  
/// Media Info Only
fetch_tmdb_info("Two and a Half Men (2003)", "tv",  2).then(function(search_results) {
    console.log(search_results)[0]
  });  
  
/// Actor / Cast Info Only
fetch_tmdb_info("Two and a Half Men 2003", "tv",  2).then(function(search_results) {
    console.log(search_results)[1]
  });    

Options

Parameters Meaning Default Required
query The TV show you would to search info for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode. undefined Yes
max_actors The maximum number of actor / cast members to return data for 5 No













How to search Movie Collection info:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

Usage

Paramaters (Query [REQUIRED], Type [REQUIRED])

  /// API WRAPPER USAGE EXAMPLE		
  import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")		
fetch_tmdb_info("Fast And Furious", "collection",  2).then(function(search_results) {
  console.log(search_results)
  });

Options

Parameters Meaning Default Required
query The movie collection you would to search info for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode. undefined Yes













How to search Episode info:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

Usage

A episode info query could look like the following example(s)

Two and a Half Men
Two and a Half Men (2003)
Two.and.a.Half.Men.S05E02.720p.HDTV.x264-KILLERS[rartv]

Note: Season and Episode numbers will try to be auto-detected from query, tho they can be provided manually as parameters. If no season or episode name is found or provided, an error message will occur.

Paramaters (Query [REQUIRED], Type [REQUIRED], Max Actors, Season, Episode)

 /// API WRAPPER USAGE EXAMPLE		
 import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")	

// Auto detecting season & episode # from Torrent Name
fetch_tmdb_info("Two and a Half Men.S05E02", "episode",  2).then(function(search_results) {
    console.log(search_results)
  });
	
// Regular Name (with season and episodes as paramaters) 
fetch_tmdb_info("Two and a Half Men", "episode",  2, 5, 2).then(function(search_results) {
    console.log(search_results)
  });	
	

Options

Parameters Meaning Default Required
query The TV show you would to search info for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode. undefined Yes
max_actors The maximum number of actor / cast members to return data for 5 No
season The season number to search episode info for undefined No
episode The episode number to search episode info for undefined No













How to search Actor info:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

Usage

Paramaters (Query [REQUIRED], Type [REQUIRED])

/// API WRAPPER USAGE EXAMPLE	
import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")	
fetch_tmdb_info("Eminem", "actor").then(function(search_results) {
  console.log(search_results)
  });

Options

Parameters Meaning Default Required
query The actor you would to search info for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode, Similar, Reviews. undefined Yes













How to search TV / Movie reviews:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

Usage

A query name could look like the following example(s)

Two and a Half Men
8 Mile (2003)
Two.and.a.Half.Men.S05E02.720p.HDTV.x264-KILLERS[rartv]

for more accurate results, a year should be provided in the query.

Paramaters (Query [REQUIRED], Type [REQUIRED], Query Type [Required])

  /// API WRAPPER USAGE EXAMPLE		
  import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")		
fetch_tmdb_info("Fast And Furious", "reviews",  "movie").then(function(search_results) {
  console.log(search_results)
  });

Options

Parameters Meaning Default Required
query The movie or TV show you would like to search reviews for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode, Similar, Reviews. undefined Yes
query_type Type of query to search reviews for TV or Movie. undefined Yes













How to search Similar movies / tv shows:

You will require a API key from TheMovieDB and need to set your API key using tmdb_api_key("YOUR API KEY") with your valid API key

Usage

A query name could look like the following example(s)

Two and a Half Men
8 Mile (2003)
Two.and.a.Half.Men.S05E02.720p.HDTV.x264-KILLERS[rartv]

for more accurate results, a year should be provided in the query.

Paramaters (Query [REQUIRED], Type [REQUIRED], Query Type [Required])

  /// API WRAPPER USAGE EXAMPLE		
  import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/src/themoviedb-api-wrapper.js' 
  // Valid API Key	
 tmdb_api_key("YOUR API KEY HERE")		
fetch_tmdb_info("Fast And Furious", "similar",  "movie").then(function(search_results) {
  console.log(search_results)
  });

Options

Parameters Meaning Default Required
query The movie, TV show or collection you would to similar info for undefined Yes
type Type of query to search details for - options:Movie, TV, Actor, Collection, Episode, Similar, Reviews. undefined Yes
query_type Type of query to search similar results for TV or Movie. undefined Yes




















CDN URL

HTML script

<script type="module" src="https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/dist/themoviedb-api-wrapper.min.js" defer></script> 

Import

import {fetch_tmdb_info, tmdb_api_key} from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/TheMovieDB-API-Wrapper.js/dist/themoviedb-api-wrapper.min.js'

Contributing GitHub

Want to improve this project? Create a pull request with detailed changes / improvements! If approved you will be added to the list of contributors of this awesome project!

See also the list of contributors who participate in this project.

License GitHub

This project is licensed under the MIT License - see the LICENSE file for details.