imdb-scrapper-by-sunbirder v0.0.3
IMDB Scrapper
This is one stop tool/lib for getting any type of data from IMDB website. For instance, you can get cast(s) of a movie or awards won by that movie and some of it's basic information. All the images function provides images with title and poster of high quality. Every function in this lib is asynchronous, they all return a promise. The module is made to be modular for different functions. It provides many functions:
scrapper(id):idrefers to IMDBID like tt1825683. This function provides some basic metadata like genre, runtime, plot etc.awardsPage(id):idrefers to IMDBID like tt1825683. This function provides list of awards won by the movie. By default it provides first three awards or most rated ones.getCast(id[,n]):idrefers to IMDBID like tt1825683,nis optional, it specify number of actors and actresses. By default it is set to 20. This function provide cast of the movies.getFull(id):idrefers to IMDBID like tt1825683. This function is the amalgamation of above three. And its configurations are set to default.- For making a get request use request
getActor(id): to get detail of the actor id is the actor id like nm43124.This function provide basic info about the actor like name ,birthdate, image etcsearchActor(term):This function provide the serach functionality for actorsepisodePage(id,seasonNumber):the season no. is the season which is requiredsimpleSearch(term):This provide a fast way to get autocomplete suggestions .Under the hood it uses the imdb api for result.No scrapping is involved in the process.serach(term): This provide api to serach fortermusing scrapping.getTrendingGenre(genre,n), getTrending(n,type):get movies trending based ongenreortype =['tv','movies'].getStarsBornToday(),getStarsBorn(date):gives the stars born ondateor today.changeQuality(url,n)a function to change the quality of image inurlbased on the scale of 0-5 n specify the scale .
Check test.js for example of allmost very function usage and returned data ;)
Using above function in different PNC
If awards and cast is only required,
const funs = [awardsPage("tt1825683"), getCast("tt1825683", 14)];
Promise.all(funs)
.then(data => {
return { ...data[0], ...data[1] };
})
.then(movieDetails => {
console.log(movieDetails);
});To install the package
npm install --save imdb-scrapperSearch APIs
The most important aspect of any movie website is search. This module provides two search strategies:
search(term,n):termrepresents the search query andnsignify the required number of results. The function provide search results from all the genres.simpleSearch(term):termrepresents the search query. This function is faster as it directly uses the ajax calls made by IMDB page and is suited for auto complete feature.
Trending Movies
This section is not provided by any other api or scrapper including cast and awards. There are two different ways of scrapping provide by this lib:
getTrending([n]):nis an optional parameter, representing the count of result required. This function provides the trending movies known as trending 250 on IMDB website.getTrendingGenre(genre [,n]):nis an optional parameter, representing the count of result required. This function provide results sorted on the basis of genres.
Have a look at outputGenerator for expamle and output for output example also have look at example
I hope it helps.