Amazon Product Scraper for Python
⚡ Features
- 📦 Product Details: Scrape by ASIN, URL, keywords, category, and best sellers.
- 🌍 Global Products: Scrape global products by URL, category, seller, keywords, and brand.
- ⭐ Reviews: Get user reviews, ratings, and dates.
- 🏬 Seller Info: Extract seller details and business profiles.
- 📈 Product Listings: Get product listings by keyword and domain.
- Managed Requests: Uses Thordata’s Web Scraper API for request handling and proxy management.
- 批量支持: 大多数爬虫都支持批量模式,可一次性提交多个任务。
🚀 Quick Start
1. Get Credentials
Get your free scraping token from the Thordata Dashboard.
2. Install
git clone https://github.com/Thordata/amazon-product-scraper-python.git
cd amazon-product-scraper-python
pip install -r requirements.txt
Copy .env.example to .env and fill in your tokens:
THORDATA_SCRAPER_TOKEN=your_token
THORDATA_PUBLIC_TOKEN=your_public
THORDATA_PUBLIC_KEY=your_key
4. Run Examples
1. Amazon Product Details Scraper
By ASIN:
python main.py product asin B0BZYCJK89
By URL (with optional zip_code):
python main.py product url "https://www.amazon.com/dp/B0BRXPR726" --zip-code 94107
By Keywords:
python main.py product keywords "Apple Watch" --page-turning 2 --lowest-price 1 --highest-price 10000
2. Amazon Global Product Details Scraper
By URL:
python main.py global url "https://www.amazon.com/dp/B0CHHSFMRL/"
3. Amazon Product Review Scraper
python main.py reviews "https://www.amazon.com/dp/B0BRXPR726"
python main.py seller "https://www.amazon.com/sp?ie=UTF8&seller=A3AZYNALJBV2WE&asin=B099S46ZRQ"
5. Amazon Product Listing Scraper
python main.py listing "X-box" "https://www.amazon.com/" --page-turning 1
All data is saved to output/ in JSON format.
🏗️ How it Works
This scraper uses Thordata’s Web Scraper API (Hybrid Mode):
- Task Creation: Sends scraping parameters to Thordata’s cloud cluster.
- Auto-Polling: The SDK (
run_task) automatically polls for completion.
- Result Retrieval: Downloads the clean JSON data once ready.
This architecture ensures you never get blocked and receive clean, structured data.
What This Example Does Not Collect
This repository is an example client for authorized Thordata Web Scraper API requests. It does not include Amazon credentials, cookies, browser sessions, or source-site access controls.
The script writes API responses to local files under output/. Review generated files before sharing them, and never commit credentials, tokens, cookies, or private data.
Access to this code does not grant rights to collect, reuse, train on, or redistribute third-party data. Use the example only for lawful and authorized workflows.
Failure Behavior
When the scraper service returns an error response, the script writes the error payload to:
output/error_<operation>_<timestamp>.json
Successful responses are written to:
output/<operation>.json
Invalid credentials, unsupported parameters, rate limits, or endpoint-specific failures may result in an API error. The exact response depends on the account, endpoint, and request parameters.
For Coding Assistants
When modifying or running this example:
📄 License
MIT License. See LICENSE for details.
评论