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

hi-imdb-crawler

v0.1.3

Published

A node library to gets Movie and Tv Series info from IMDB and returns collected data as a json

Downloads

1

Readme

IMDB Crawler

A node library to get Movie and Tv Series info from IMDB and returns collected data as a json

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Nodejs, Npm

Installing

npm i hi-imdb-crawler

Options

Default options

{
    'movie': {
        'imdb_id': {
            'container': "meta[property='pageId']",
            'attr' : "content",
            'type' : "String"
        },
        'name': {
            'container': ".title_wrapper > h1[itemprop='name']",
            'attr': false,
            'type': 'String'
        },
        'directors': {
            'container': "span[itemprop='director'] > a > span[itemprop='name']",
            'attr': false,
            'type': 'String|Array'
        },
        'creators': {
            'container': "span[itemprop='creator'] > a > span[itemprop='name']",
            'attr': false,
            'type': 'String|Array'
        },
        'description': {
            'container': ".summary_text",
            'attr': false,
            'type': 'String'
        },
        'original_title': {
            'container': ".originalTitle",
            'attr': false,
            'type': 'String'
        },
        'duration': {
            'container': ".title_wrapper .subtext time[itemprop='duration']",
            'attr': false,
            'type': 'String'
        },
        'rating': {
            'container': "span[itemprop='ratingValue']",
            'attr': false,
            'type': 'String|Float'
        },
        'image': {
            'container': "meta[property='og:image']",
            'attr': 'content',
            'type': 'Image'
        },
        'genres': {
            'container': "div[itemprop='genre'] a",
            'attr': false,
            'type': 'String|Array'
        },
    },

    'series': {
        'imdb_id': {
            'container': "meta[property='pageId']",
            'attr' : "content",
            'type' : "String"
        },
        'name': {
            'container': ".title_wrapper > h1[itemprop='name']",
            'attr': false,
            'type': 'String'
        },
        'creators': {
            'container': "span[itemprop='creator'] > a > span[itemprop='name']",
            'attr': false,
            'type': 'String|Array'
        },
        'description': {
            'container': ".summary_text",
            'attr': false,
            'type': 'String'
        },
        'original_title': {
            'container': ".originalTitle",
            'attr': false,
            'type': 'String'
        },
        'duration': {
            'container': ".title_wrapper .subtext time[itemprop='duration']",
            'attr': false,
            'type': 'String'
        },
        'rating': {
            'container': "span[itemprop='ratingValue']",
            'attr': false,
            'type': 'String|Float'
        },
        'image': {
            'container': "meta[property='og:image']",
            'attr': 'content',
            'type': 'Image'
        },
        'genres': {
            'container': "div[itemprop='genre'] a",
            'attr': false,
            'type': 'String|Array'
        }
    },
    'seasons': {
        'name': {
            'container': "div.seasons-and-year-nav div>a[href*='?season=']",
            'attr': false,
            'type': 'String'
        },
        'episode_url': {
            'container': "div.list.detail.eplist > .list_item a[itemprop='name'] ",
            'attr': 'href',
            'type': 'String'
        }
    },
    'episodes': {
        'imdb_id': {
            'container': "meta[property='pageId']",
            'attr' : "content",
            'type' : "String"
        },
        'season': {
            'container': "div.bp_item > .bp_content > .bp_description > .bp_heading",
            'attr' : false,
            'type' : "String|Split",
            'action' : 'split(" ")[1]'
        },
        'name': {
            'container': ".title_wrapper > h1[itemprop='name']",
            'attr': false,
            'type': 'String'
        },
        'directors': {
            'container': "span[itemprop='director'] > a > span[itemprop='name']",
            'attr': false,
            'type': 'String|Array'
        },
        'creators': {
            'container': "span[itemprop='creator'] > a > span[itemprop='name']",
            'attr': false,
            'type': 'String|Array'
        },
        'description': {
            'container': ".summary_text",
            'attr': false,
            'type': 'String'
        },
        'original_title': {
            'container': ".originalTitle",
            'attr': false,
            'type': 'String'
        },
        'duration': {
            'container': ".title_wrapper .subtext time[itemprop='duration']",
            'attr': false,
            'type': 'String'
        },
        'rating': {
            'container': "span[itemprop='ratingValue']",
            'attr': false,
            'type': 'String|Float'
        },
        'image': {
            'container': "meta[property='og:image']",
            'attr': 'content',
            'type': 'Image'
        },
        'genres': {
            'container': "div[itemprop='genre'] a",
            'attr': false,
            'type': 'String|Array'
        },
    },
}

These options are against imdb site updates. So you can basicly change which tag to use for getting the content. The extractor will try to extract the content from the options you passed.

To change default options you should pass your own options as a param while creating new instance of ImdbCrawler

const ImdbCrawler = require('hi-imdb-crawler');

let options = {
'movie': {
        'imdb_id': {
            'container': "meta[property='imdbId']",
            'attr' : "content",
            'type' : "String"
        },
        'name': {
            'container': ".title_wrapper > h2[itemprop='name']",
            'attr': false,
            'type': 'String'
        }
    },
'series': {
        'rating': {
            'container': "span[itemprop='rating']",
            'attr': false,
            'type': 'String|Float'
        }
    }
    
}

let imdb_code = "tt4227538";
let imdbCrawler = new ImdbCrawler(imdb_code,options);

imdbCrawler.getEpisode(function(data) {
    console.log(data);
});

Usage

to get an episode

const ImdbCrawler = require('hi-imdb-crawler');

let imdb_code = "tt4227538";
let imdbCrawler = new ImdbCrawler(imdb_code);

imdbCrawler.getEpisode(function(data) {
    console.log(data);
});

to get an movie

const ImdbCrawler = require('hi-imdb-crawler');

let imdb_code = "tt0110413";
let imdbCrawler = new ImdbCrawler(imdb_code);

imdbCrawler.getMovie(function(data) {
    console.log(data);
});

to get an series

You can get series with or without episodes. If you want to get with episodes basicly pass true param after callback function in getSeries

without episodes

const ImdbCrawler = require('hi-imdb-crawler');

let imdb_code = "tt4574334";
let imdbCrawler = new ImdbCrawler(imdb_code);

imdbCrawler.getSeries(function(data) {
    console.log(data);
});

with episodes

const ImdbCrawler = require('hi-imdb-crawler');

let imdb_code = "tt4574334";
let imdbCrawler = new ImdbCrawler(imdb_code);

imdbCrawler.getSeries(function(data) {
    console.log(data);
},true);

Running the tests

npm test

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the [https://www.gnu.org/licenses/gpl-3.0.html](GNU GENERAL PUBLIC LICENSE) for details