Giter Club home page Giter Club logo

tmdb-fetch's Introduction

tmdb-fetch

unofficial small tmdb api client

get info of millions of movies and series from the public api of https://www.themoviedb.org/

this library provides functions to generate request links if you don't know api process

Get started

you need a TMDB account and api_key, only one for user!

<script src="https://unpkg.com/tmdb-fetch/dist/tmdb-fetch.min.js"></script>
<script>
  tmdb('<<api_key>>', { language: 'es-MX', include_adult: false })
    .movies()
    .search('toy story 4')
    .then(console.log)
    .catch(console.error)
</script>

Usage

install

<script src="https://unpkg.com/tmdb-fetch/dist/tmdb-fetch.min.js"></script>
import tmdb from 'tmdb-fetch'

inicialize

single method chain

tmdb('<<api_key>>', { include_adult: false }).movies().search('spiderman').then(render)

multiple config

tmdb('<<api_key>>', { language: 'es-MX', include_adult: false })

const app1 = tmdb.movies() // spanish and no adult config inherited
const app2 = tmdb.tvSeries({ language: 'fr-FR' }) // spanish overloaded to french, no adult
const app3 = tmdb.movies({ with_genres: ['comedy'] }) // comedy in spanish

send requests

search a movie

// show user results of movies from an html input
const value = getValueAnyWay('#my-input')

app1.search(value).then(({ results }) => renderAnyWay(results))

discover movies

// movies on cinemas at 2019
app3
  .discover({ primary_release_date: { gte: '2019-01-01', lte: '2019-12-31' } })
  .then(({ results }) => renderAnyWay(results))

full info about movie

const annabelle3Info = await app1.findById(521029)

Extra features

image full url

app3.findById(521029).then(({ title, poster_path, overview }) => {
  el.innerHTML = /*html*/ `
    <h3>${title}</h3>
    <img src="${tmdb.image(poster_path, 300)}"/>
    <p>${overview}</p>
  `
})

Contribute

this library is small, i'll be happi of acept commits with more funcionality

create better documentation and copy-paste examples is also planned

tmdb-fetch's People

Contributors

luismidevmx avatar

Watchers

 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.