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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file how_to_scrape_imdb_data-0.0.1.tar.gz.
File metadata
- Download URL: how_to_scrape_imdb_data-0.0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40bc8bbd04a3fda0940006173786a2b8bdc237e9221d4e41cbcc0b5e6d70b096
|
|
| MD5 |
f0c076357ac2498e7298f56bdcf295e2
|
|
| BLAKE2b-256 |
4df18098730cd268d869b41e3a2a4cb7b8fc6286c78b185b12f1dae5bc7dc971
|
File details
Details for the file how_to_scrape_imdb_data-0.0.1-py3-none-any.whl.
File metadata
- Download URL: how_to_scrape_imdb_data-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9908dc471eb072cb55307333a7d2d0a283306175ffb66a653294a7952f4ed48b
|
|
| MD5 |
59025769ef25690ef17cd3026be4ccf5
|
|
| BLAKE2b-256 |
bad9c18e6a97cff66cefea634f9fd358b3a8604442699dbe1c6c746967eec885
|