Browse the source
Find site modules, run scripts, and the complete scraper directory.
Python SDK
Learn about authentication, API methods, and remote CDP sessions.
Install and configure
You need Git, Python 3.10 or later, and an AdsCrawl API key. The scraper repository has a higher Python requirement than the standalone SDK. Run these commands from a terminal:- macOS / Linux
- Windows PowerShell
adscrawl_scrapers, the AdsCrawl SDK, Playwright, parsers, and development test dependencies. These examples connect to remote Chromium browsers; you do not need to run playwright install chromium.
Running a scraper or a site’s live tests uses AdsCrawl credits. Review the input URLs, dates, and page limits in
run.py before running it. Keep API keys in environment variables and out of source control.Example: Bing search and related keywords
From the repository root, run the included script:bing.py:
The included
run.py searches for web scraping emails across up to three pages and writes results/serps.json and results/keywords.json inside bing-scraper/.
To customize the query and start with one page, save this as bing-scraper/custom.py and run python custom.py from that directory:
position, title, url, origin, domain, description, and date; some values can be absent or null. Bing may return no related keywords for a particular query. The module explicitly uses countryCode="GB", so the default country environment variable does not override its route.
Example: ChatGPT answer as Markdown
From the repository root:chatgpt.scrape_conversation(prompt) and saves the returned Markdown to chatgpt-scraper/results/conversation.md. Edit the prompt in run.py to change the question.
For a small standalone example, save this as chatgpt-scraper/custom.py and run python custom.py from that directory:
Choose another website
Open a site’s directory, inspect itsrun.py, update the inputs, and run it from that directory. Function signatures and output schemas differ by site; the modules are local files such as bing.py, rather than submodules of the installed adscrawl SDK.
These links describe the examples present in the repository. Check the verification report for the status of the functions you plan to use. See the complete list of 81 sites and machine-readable function catalog.
Concurrency, region, and sessions
For example, on macOS or Linux:
$env:ADSCRAWL_CONCURRENCY = "1" and $env:ADSCRAWL_DEFAULT_COUNTRY = "US".
A site’s explicit countryCode takes precedence. A custom proxy cannot be combined with countryCode. Multiple clients or processes can consume more sessions than one client’s limit, so consider their combined usage.
Most examples use AsyncAdsCrawl.cdp.create, connect Playwright over CDP, capture HTML and network responses, and release sessions with cdp.close. Named sessions reuse cookies, storage, and the browser connection within a site operation. Standalone scripts use adscrawl_scrapers.run(...) to close shared clients on exit. Air France uses the synchronous SDK; Google AI Mode uses spa.extract.
Build your own parser
After installing the repository, save this as a Python script and run it with your API key configured:response.content for the page body, response.selector for CSS/XPath extraction, and response.network for captured XHR/fetch responses. For a JSON response body, use response.json(). The asynchronous context manager closes the client’s remote sessions on exit.
Verify results
The repository’s dated live report records suites across 81 sites on October 27, 2026. For that audit, Bing returned 30 search results and 8 related keywords; the ChatGPT test returned an answer containing “Paris.” Those counts describe the recorded tests, not guaranteed output from the snippets above. The fully passed suites were App Store, Bing, ChatGPT, Fashionphile, Idealo, IMDb, Imovelweb, Reddit, Rightmove, Shopify, Similarweb, Ticketmaster, Twitter / X, Vestiaire Collective, and Zillow. Passing applies to the existing tested functions and inputs on that date. Some individual site READMEs still contain earlier verification notes; use the dated report for this audit’s evidence and scope. Files already inresults/ are historical samples. Inspect newly generated output and required fields before using the data; an empty result does not establish that a scraper worked.
From the repository root, run offline checks without an API key or credit usage:
Troubleshooting
The shared transport does not automatically retry billable requests. Some site modules contain their own retry loops; inspect the module before increasing the workload. See credits and limits, remote CDP, and the repository’s transport notes.