Skip to main content

Python client for scraping IMDb title data using the ScrapingBee web scraping API

Project description

how-to-scrape-imdb-data

Scrape IMDb title data into parsed JSON. A thin Python wrapper over the ScrapingBee web scraping API that fetches an IMDb page through residential proxies and returns fields using the extraction rules from ScrapingBee's IMDb guide.

pip install how-to-scrape-imdb-data

If you searched for how to scrape IMDb data, or you need a reliable IMDb scraper that does not get blocked, this is the wrapper. Requires Python 3.8+ and requests.

30-second example

from how_to_scrape_imdb_data import ImdbScraper

scraper = ImdbScraper(api_key="YOUR_API_KEY")

movie = scraper.title("tt1375666")  # Inception
print(movie)

Grab a key first. ScrapingBee gives 1,000 credits with no card at scrapingbee.com.

The client

ImdbScraper(api_key: str, timeout: int = 60)

Requests use a premium (residential) proxy by default, which is what keeps IMDb from blocking a repeated job. The client serializes extraction rules and builds title URLs for you.

Methods

title(title_id, extract_rules=None, **kwargs)

Scrape an IMDb title page by its id, for example tt1375666. Returns JSON with title, rating, genres, summary, and director by default.

Argument Purpose
title_id IMDb id such as tt1375666 (required)
extract_rules Override the default fields with your own selectors
premium_proxy Residential proxies (default True)
render_js Force or disable JavaScript rendering (default: platform default)
extra Dict of any other documented HTML API parameter

scrape(url, extract_rules=None, **kwargs)

Fetch any IMDb URL, such as a person page or a chart. Returns rendered HTML by default, or JSON when you pass extract_rules.

Default fields

The default extraction uses the selectors from ScrapingBee's IMDb guide:

{
    "title": {"selector": "h1", "type": "text"},
    "rating": {"selector": "span[role='img']", "type": "text"},
    "genres": {"selector": "div[data-testid='genres'] a", "type": "list"},
    "summary": {"selector": "span[data-testid='plot-xl']", "type": "text"},
    "director": {"selector": "li[data-testid='title-pc-principal-credit']:first-child a", "type": "text"},
}

Pass your own extract_rules when you need different fields, or add ai_extract_rules through extra for natural-language extraction.

Scrape a list of movies

scraper = ImdbScraper(api_key="YOUR_API_KEY")

ids = ["tt0111161", "tt0068646", "tt1375666"]
catalog = [scraper.title(tid) for tid in ids]

Credits

ScrapingBee bills successful requests. An IMDb title request with a premium proxy and the default rendering costs 25 credits. CSS extraction adds nothing; ai_extract_rules adds 5. See scrapingbee.com/pricing.

Notes

  • Scrape public IMDb pages only. ScrapingBee's terms prohibit scraping behind a login.
  • Selectors reflect IMDb's current title-page markup and may need updating over time.

Links

License

MIT

Disclaimer

Unofficial Python client built on the ScrapingBee web scraping API. Not affiliated with ScrapingBee or IMDb. Comply with IMDb's terms of service and applicable law.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

how_to_scrape_imdb_data-0.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

how_to_scrape_imdb_data-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file how_to_scrape_imdb_data-0.0.2.tar.gz.

File metadata

  • Download URL: how_to_scrape_imdb_data-0.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for how_to_scrape_imdb_data-0.0.2.tar.gz
Algorithm Hash digest
SHA256 30a41646aa03586cbeb9c9719c18b2ba251bd5e0d57630acabdd8b9f7b848180
MD5 12f46ed27f450c35485d0ee9312d1745
BLAKE2b-256 5304154612abd81298093aaccdc7117207fba82c16ab0609f0d6576c6e14662a

See more details on using hashes here.

File details

Details for the file how_to_scrape_imdb_data-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for how_to_scrape_imdb_data-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93f1f311ca344d67d564c6cd8f5fe82235a87513e3bb4b41c304d154323da418
MD5 79a9bda2c6e28254510aaa7297bcc460
BLAKE2b-256 a10b9072a09508b9429aecb2f9f80f7e48a122dcdc883686cecb242579da5ae9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page