# IMDb Scraper (`dtrungtin/imdb-scraper`) Actor

Free IMDb API to extract and download data on movies, TV shows, video games, and other listings from IMDb. Delivers custom machine-readable IMDb datasets containing all information on your selected listings.

- **URL**: https://apify.com/dtrungtin/imdb-scraper.md
- **Developed by:** [Tin](https://apify.com/dtrungtin) (community)
- **Categories:** Videos
- **Features:** Limited permissions
- **Stats:** 1,069 total users, 29 monthly users, 94.9% runs succeeded, 15 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Features

Our free IMDb Scraper enables you to extract and download data about movies, video games, TV shows, streaming content, and personalities from [IMDb.com](https://www.imdb.com/).

### Why scrape IMDb?

Launched over 30 years ago, IMDb now contains over 8 million titles and over 10 million personalities. It is the most comprehensive film and TV show database in the world.

IMDb datasets are frequently used to train AI models and recommendation systems and several different datasets are freely available to [download](https://www.imdb.com/interfaces/). You should also check out the [IMDb developer page](https://developer.imdb.com/) if you're interested in accessing data products direct from IMDb.

However, if your specific use case means that you need to scrape IMDb, our free IMDb Scraper effectively creates an unofficial IMDb API and gives you an alternative way to access live IMDb data direct from the website.

### Tutorial

Our [Beginner's Guide to Web Scraping](https://apify.com/web-scraping) has a really great explanation of how to get started with web scraping. And if you skip ahead to the section on [Web Scraping with Apify](https://apify.com/web-scraping#scraping-with-apify), you'll find a quick guide on how to use IMDb Scraper to scrape data about The Queens's Gambit. If you still have questions on how to use the scraper, just email support@apify.com.

### Cost of usage

Note that it is much more efficient to run one longer scrape (at least one minute) than more shorter ones because of the startup time.

Based on our experience, you can get **1,000 results for as little as $0.30** if you run the IMDb Scraper on
the [Apify platform](https://apify.com).

### Input

| Field | Type | Description | Default value
| ----- | ---- | ----------- | -------------|
| startUrls | array | List of [request](https://sdk.apify.com/docs/api/request#docsNav) objects that will be deeply crawled. The URL can be top level such as `https://www.imdb.com/search/title/` or `https://www.imdb.com/find?q=bond` or a detail URL, such as `https://www.imdb.com/title/tt7286456`. | `[{ "url": "https://www.imdb.com/search/title/" }]`|
| maxItems | number | Maximum number of actor pages that will be scraped | all found |
| extendOutputFunction | string | Function that takes a Cheerio handle ($) as argument and returns data that will be merged with the result output. More information in [Extend output function](#extend-output-function) | |
| proxyConfiguration | object | Proxy settings of the run. If you have access to Apify Proxy, leave the default settings. If not, you can set `{ "useApifyProxy": false" }` to disable proxy usage | `{ "useApifyProxy": true }`|

### Output

The IMDb Scraper output is stored in a dataset. Each item contains information about a movie, TV show, or other IMDb listing. For example:

```
{
  "title": "Turandot (1981)",
  "original title": "",
  "runtime": "",
  "certificate": "",
  "year": "1981",
  "rating": "",
  "ratingcount": "",
  "description": "",
  "stars": "Montserrat Caballé, Rémy Corazza, Fernand Dumont",
  "director": "Pierre Desfons",
  "genre": "Musical",
  "country": "France",
  "url": "https://www.imdb.com/title/tt0834174"
}
```

#### Extend output function

You can use this function to update the result output of this actor. This function gets a Cheerio handle `$` as an argument so you can choose what data from the page you want to scrape. The output from this function will get merged with the result output.

The return value of this function has to be an object!

You can return fields to achive three different things:

- Add a new field - Return object with a field that is not in the result output
- Change a field - Return an existing field with a new value
- Remove a field - Return an existing field with a value `undefined`

```
($) => {
    return {
        "story line": $('#titleStoryLine div p span').text().trim(),
        "original title": "NA",
        url: undefined
    }
}
```

This example will add a new field `story line`, change the `original title` field and remove the `url` field

```
{
  "title": "Turandot (1981)",
  "story line": "",
  "original title": "NA",
  "runtime": "",
  "certificate": "",
  "year": "1981",
  "rating": "",
  "ratingcount": "",
  "description": "",
  "stars": "Montserrat Caballé, Rémy Corazza, Fernand Dumont",
  "director": "Pierre Desfons",
  "genre": "Musical",
  "country": "France"
}
```

### Changelog

IMDb Scraper is regularly updated, so please check the [changelog](https://github.com/dtrungtin/actor-imdb-scraper/blob/master/CHANGELOG.md) for fixes and improvements.

### Related actors

dtrungtin/imdb-search-scraper
dtrungtin/openai-web-scraper

# Actor input Schema

## `startUrls` (type: `array`):

List of URLs that will be scraped or crawled. Go to https://www.imdb.com/search/title/ and choose filter you want.

## `maxItems` (type: `integer`):

Limit of detail/product pages to be scraped

## `proxyConfiguration` (type: `object`):

The best option is usually Automatic proxy. But you can also use your own proxies or no proxy

## `extendOutputFunction` (type: `string`):

Function that takes a JQuery handle ($) as argument and returns data that will be merged with the default output

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.imdb.com/find/?q=game&ref_=nv_sr_sm"
    }
  ],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "extendOutputFunction": "($) => { return {} }"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://www.imdb.com/find/?q=game&ref_=nv_sr_sm"
        }
    ],
    "maxItems": 50,
    "proxyConfiguration": {
        "useApifyProxy": true
    },
    "extendOutputFunction": ($) => { return {} }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dtrungtin/imdb-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": [{ "url": "https://www.imdb.com/find/?q=game&ref_=nv_sr_sm" }],
    "maxItems": 50,
    "proxyConfiguration": { "useApifyProxy": True },
    "extendOutputFunction": "($) => { return {} }",
}

# Run the Actor and wait for it to finish
run = client.actor("dtrungtin/imdb-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.imdb.com/find/?q=game&ref_=nv_sr_sm"
    }
  ],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "extendOutputFunction": "($) => { return {} }"
}' |
apify call dtrungtin/imdb-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dtrungtin/imdb-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/poWuYPmbfLGBn5Mf8/builds/YOrR7nSiLYOlwivAz/openapi.json
