
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
js-imdb-scraper
Advanced tools
Scrapes TV Show data from the IMDB website.
To install, use:
npm i js-imdb-scraper
Then either import the entire module, or whichever methods you need:
const imdb = require("js-imdb-scraper");
// OR
const { getSearchResults, getSeasonRatings, getAllRatings, getNumSeasons } = require("js-imdb-scraper");
The getSearchResults(showName)
method uses the IMDB search page to list shows that mach the given input string.
The input string should contain letters, numbers and spaces only. This is usually enough to find the right shows.
This method will only show TV Shows, not movies.
const imdb = require("js-imdb-scraper");
const example = async () => {
const searchResults = await imdb.getSearchResults("westworld");
return searchResults;
}
This method gives us:
[
{
title: 'Westworld (2016)',
id: 'tt0475784',
img: 'https://m.media-amazon.com/images/M/MV5BMTRmYzNmOTctZjMwOS00ODZlLWJiZGQtNDg5NDY5NjE3MTczXkEyXkFqcGdeQXVyMDM2NDM2MQ@@._V1_UX32_CR0,0,32,44_AL_.jpg'
},
{
title: 'Beyond Westworld (1980)',
id: 'tt0080198',
img: 'https://m.media-amazon.com/images/M/MV5BMTU4NTIyMjM3Ml5BMl5BanBnXkFtZTgwMDk0OTQ0MzE@._V1_UX32_CR0,0,32,44_AL_.jpg'
}
]
Once we have the the show details, we can use the IMDB show ID to get a seasons ratings using getSeasonRating(showId, season)
. Here, we select the 2016 westworld show and find season 1 ratings:
const imdb = require("js-imdb-scraper");
const example = async () => {
const searchResults = await imdb.getSearchResults("westworld");
const selectedShowId = searchResults[0].id;
const seasonOneRatings = await imdb.getSeasonRatings(selectedShowId, 1);
return seasonOneRatings;
}
This gives us:
[
{ episode: 1, rating: '8.9' },
{ episode: 2, rating: '8.6' },
{ episode: 3, rating: '8.4' },
{ episode: 4, rating: '8.7' },
{ episode: 5, rating: '8.7' },
{ episode: 6, rating: '8.9' },
{ episode: 7, rating: '9.5' },
{ episode: 8, rating: '8.8' },
{ episode: 9, rating: '9.4' },
{ episode: 10, rating: '9.7' }
]
With the IMDB show ID we can receive all season ratings using getAllRatings(showId)
:
const imdb = require("js-imdb-scraper");
const example = async () => {
const searchResults = await imdb.getSearchResults("westworld");
const selectedShowId = searchResults[0].id;
const allSeasonRatings = await imdb.getAllRatings(selectedShowId);
return allSeasonRatings;
}
This gives us:
{
'1': [
{ episode: 1, rating: '8.9' },
{ episode: 2, rating: '8.6' },
{ episode: 3, rating: '8.4' },
{ episode: 4, rating: '8.7' },
{ episode: 5, rating: '8.7' },
{ episode: 6, rating: '8.9' },
{ episode: 7, rating: '9.5' },
{ episode: 8, rating: '8.8' },
{ episode: 9, rating: '9.4' },
{ episode: 10, rating: '9.7' }
],
'2': [
{ episode: 1, rating: '8.2' },
{ episode: 2, rating: '8.1' },
{ episode: 3, rating: '8.0' },
{ episode: 4, rating: '9.0' },
{ episode: 5, rating: '7.9' },
{ episode: 6, rating: '8.2' },
{ episode: 7, rating: '8.6' },
{ episode: 8, rating: '9.2' },
{ episode: 9, rating: '8.8' },
{ episode: 10, rating: '8.8' }
],
'3': [
{ episode: 1, rating: '8.5' },
{ episode: 2, rating: '8.4' },
{ episode: 3, rating: '8.4' },
{ episode: 4, rating: '9.0' },
{ episode: 5, rating: '8.2' },
{ episode: 6, rating: '8.5' },
{ episode: 7, rating: '8.1' },
{ episode: 8, rating: '7.4' }
]
}
With the IMDB ID we can find the number of show seasons by using getNumSeasons(showId)
:
const imdb = require("js-imdb-scraper");
const example = async () => {
const searchResults = await imdb.getSearchResults("westworld");
const selectedShowId = searchResults[0].id;
const numSeasons = await imdb.getNumSeasons(selectedShowId);
return numSeasons;
}
This gives us:
1
This project is licensed under the MIT license - see the LICENSE file for details.
FAQs
Simple IMDB scraper
The npm package js-imdb-scraper receives a total of 2 weekly downloads. As such, js-imdb-scraper popularity was classified as not popular.
We found that js-imdb-scraper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.