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

@ifraan_/tmdb.js

v1.1.2

Published

Wrapper for TMDB API.

Downloads

30

Readme

Instalattion

You gotta request a Free API key on TMDB

You can use both v3 and v4 keys

Dependencies

axios

To install use:

npm i @ifraan_/tmdb.js

To use this wrapper you first need to initialize the class API

const { API } = require('@ifraan_/tmdb.js')
const key = 'your-key-from-tmdb';
const lang = 'es' // OPTIONAL -> Pass a ISO 639-1 value (en as deafult value)
const api = new API(key, lang)

| Methods | Description | | --------- | ---------------------------------------------------------------------- | | search | Search for Movies and TV-Shows | | tv | Details for TV Shows | | movie | Details for Movies | | similar | Similar entries for movies/tv | | providers | Where to watch the entries | | raw | Returns every response got so far, so you can re-use the existing data |

Example code:

const { API } = require('@ifraan_/tmdb.js');
const api = new API('your-key', 'es')
    try {
        const search = await api.search('from the Loop')
        const [first_result] = search.results;
        console.log('First Result: ', first_result)
        /*
        First Result:  {
            backdrop_path: 'https://image.tmdb.org/t/p/original/6LmHxVcp5dgGyHG8kTVcrQxbaHq.jpg',
            first_air_date: '2020-04-03',
            genre_ids: [ 18, 9648, 10765 ],
            id: 93784,
            media_type: 'tv',
            name: 'Historias del bucle',
            origin_country: [ 'US' ],
            original_language: 'en',
            original_name: 'Tales from the Loop',
            overview: 'Tales from the Loop explora la fantástica y misteriosa ciudad y las personas que viven por encima de ‘The Loop’, una máquina construida para desbloquear y explorar los misterios del universo, haciendo posible cosas que anteriormente solo estaban relegadas a la ciencia ficción. Basada en la obra de Simon Stålenhag.',
            popularity: 12.117,
            poster_path: 'https://image.tmdb.org/t/p/original/56D0QFyLhrRp1ZTBz8Gw10qtZas.jpg',
            vote_average: 7,
            vote_count: 251
        }
        */
        const details = await api[first_result.media_type](first_result.id)
        console.log('Details: ', details)
        /* 
        Details:  {
            adult: false,
            backdrop_path: '/6LmHxVcp5dgGyHG8kTVcrQxbaHq.jpg',
            created_by: [
                {
                    id: 1710710,
                    credit_id: '5e8943ef6c74b900159683df',
                    name: 'Nathaniel Halpern',
                    gender: 2,
                    profile_path: null
                }
            ],
            episode_run_time: [ 50 ],
            first_air_date: '2020-04-03',
            genres: [
                { id: 18, name: 'Drama' },
                { id: 9648, name: 'Misterio' },
                { id: 10765, name: 'Sci-Fi & Fantasy' }
            ],
            homepage: 'https://www.amazon.com/dp/B084NW4C2K',
            id: 93784,
            in_production: false,
            languages: [ 'en' ],
            last_air_date: '2020-04-03',
            last_episode_to_air: {
                air_date: '2020-04-03',
                episode_number: 8,
                id: 2200694,
                name: 'Hogar',
                overview: 'Un niño busca a su hermano perdido en un intento por recuperar             pasado.',
                production_code: '',
                runtime: 50,
                season_number: 1,
                still_path: '/h9ruc4rXCJEbgFxHAou7PtMG8iX.jpg',
                vote_average: 8.1,
                vote_count: 8
            },
            name: 'Historias del bucle',
            next_episode_to_air: null,
            networks: [
                {
                  id: 1024,
                  name: 'Amazon',
                  logo_path: '/ifhbNuuVnlwYy5oXA5VIb2YR8AZ.png',
                  origin_country: ''
                }
            ],
            number_of_episodes: 8,
            number_of_seasons: 1,
            origin_country: [ 'US' ],
            original_language: 'en',
            original_name: 'Tales from the Loop',
            overview: 'Tales from the Loop explora la fantástica y misteriosa ciudad y personas que viven por encima de ‘The Loop’, una máquina construida para desbloquear y explorar los     misterios del universo, haciendo posible cosas anteriormente solo estaban relegadas a la ciencia ficción. Basada en la obra de Simon Stålenhag.',
            popularity: 12.117,
            poster_path: '/56D0QFyLhrRp1ZTBz8Gw10qtZas.jpg',
            production_companies: [
                {
                    id: 101405,
                    logo_path: null,
                    name: '6th & Idaho',
                    origin_country: 'US'
                },
                ...
            ],
            production_countries: [ { iso_3166_1: 'US', name: 'United States of America' } ],
            seasons: [
                {
                    air_date: '2020-03-11',
                    episode_count: 1,
                    id: 180625,
                    name: 'Especiales',
                    overview: '',
                    poster_path: null,
                    season_number: 0
                },
                {
                    air_date: '2020-04-03',
                    episode_count: 8,
                    id: 132915,
                    name: 'Temporada 1',
                    overview: '',
                    poster_path: '/moNfJvC7Ivr5I8eqSYrSLcs9Ukx.jpg',
                    season_number: 1
                }
            ],
            spoken_languages: [ { english_name: 'English', iso_639_1: 'en', name: 'English' } ],
            status: 'Ended',
            tagline: '',
            type: 'Scripted',
            vote_average: 7,
            vote_count: 251
        }
        */
        const similar = await api.similar(first_result.media_type, first_result.id)
        console.log('Similar: ', similar.results[0])
        /* 
        Similar:  {
            adult: false,
            backdrop_path: '/tY6ZweSX4Mg8AYNSia9vyH1su8k.jpg',
            genre_ids: [ 16, 10765 ],
            id: 1095,
            name: 'Ghost in the Shell: Stand Alone Complex',
            origin_country: [ 'JP' ],
            original_language: 'ja',
            original_name: '攻殻機動隊 STAND ALONE COMPLEX',
            overview: "En un futuro no muy lejano, el mundo se encuentra totalmente computerizado. Seres humanos con interfaces y cerebros artificiales se funden con máquinas alcanzando un nuevo nivel de existencia entre el mundo            físico y la red digital. Para combatir los crímenes relacionados con las nuevas tecnologías ha sido creada una fuerza de choque antiterrorista con individuos 'mejorados' capaces de perseguir toda clase de criminales tanto            en el mundo real como en el virtual. La Teniente cyborg Motoko Kusanagi y sus compañeros de la Sección 9 deben resolver una delicada crisis de rehenes, detener un tanque de asalto de última generación fuera de control y            determinar la causa de los misteriosos suicidios de una serie de robots obsoletos. Todo ello antes de afrontar el desafío sin precedentes del esquivo pirata informático conocido como el 'Hombre que ríe'.",
            popularity: 24.517,
            poster_path: '/1Ix4kRPwWjM9wcrvWA25lXi781J.jpg',
            first_air_date: '2002-10-01',
            vote_average: 8.229,
            vote_count: 264
        }
        */
        const providers = await api.providers(first_result.media_type, first_result.id)
        console.log('Providers: ', providers.results['US']) // Country Code
        /* 
        Providers:  {
            link: 'https://www.themoviedb.org/tv/1411-person-of-interest/watch?locale=US',
            flatrate: [
                {
                    display_priority: 8,
                    logo_path: '/Ajqyt5aNxNGjmF9uOfxArGrdf3X.jpg',
                    provider_id: 384,
                    provider_name: 'HBO Max'
                }
            ],
            buy: [
                {
                    display_priority: 2,
                    logo_path: '/peURlLlr8jggOwK53fJ5wdQl05y.jpg',
                    provider_id: 2,
                    provider_name: 'Apple iTunes'
                },
                ...
            ]
        }
        */
    } catch (e) {
        console.log(e) 
        /* Did not find any results for [from the Loopsss] */
    }

Disclaimer

This project is fully for educational purposes.