Python scraper for AliExpress.com - the global e-commerce marketplace. Extracts product listings including titles, prices, images, and seller information using the ScrapingAnt API.
- Search products by keyword
- Pagination support (multiple pages)
- Extract product details:
- Title
- Price
- Product ID and URL
- Image URL
- Sold count
- Rating
- Shipping info
- Export to CSV and JSON
- Automatic deduplication
- Python 3.8+
- ScrapingAnt API key
Note: The free plan has a concurrency limit of 10,000 API credits. Each request with browser rendering uses approximately 10 credits.
- Clone the repository:
git clone https://github.com/kami4ka/AliExpressScraper.git
cd AliExpressScraper- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set your ScrapingAnt API key:
export SCRAPINGANT_API_KEY="your_api_key_here"python main.py laptop# Scrape 3 pages of phone listings
python main.py phone -p 3
# Export as JSON too
python main.py headphones --json
# Custom output directory
python main.py keyboard -o results/
# Specify API key directly
python main.py monitor --api-key YOUR_API_KEY| Argument | Short | Description | Default |
|---|---|---|---|
keyword |
Search keyword (required) | - | |
--pages |
-p |
Number of pages to scrape | 2 |
--delay |
-d |
Delay between requests (seconds) | 3.0 |
--output |
-o |
Output directory | output/ |
--json |
Also export as JSON | False | |
--api-key |
ScrapingAnt API key | env var |
| Field | Description |
|---|---|
title |
Product title |
price |
Current price |
product_id |
Unique product ID |
product_url |
Direct link to product page |
image_url |
Product image URL |
original_price |
Original price before discount |
sold_count |
Number of items sold |
rating |
Product rating |
store_name |
Seller store name |
shipping |
Shipping information |
scraped_at |
Timestamp of scraping |
- Builds search URL with keyword and pagination
- Sends request to ScrapingAnt API with browser rendering
- Parses HTML response using BeautifulSoup
- Extracts product data from listing cards
- Deduplicates results by product ID
- Exports to CSV/JSON
AliExpress Scraper
==================================================
Keyword: laptop
Max pages: 2
==================================================
Scraping page 1: https://www.aliexpress.com/w/wholesale-laptop.html
Page 1: scraped 15 listings, 15 new
Scraping page 2: https://www.aliexpress.com/w/wholesale-laptop.html?page=2
Page 2: scraped 15 listings, 15 new
==================================================
Total listings scraped: 30
Results exported to: output/aliexpress_laptop_20260113_180000.csv
AliExpressScraper/
├── config.py # Configuration and constants
├── models.py # Data models (ProductListing)
├── scraper.py # Main scraper class
├── utils.py # Utility functions
├── main.py # CLI entry point
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── output/ # Output directory
│ └── .gitkeep
└── README.md # Documentation
- AliExpress pages are JavaScript-heavy. ScrapingAnt handles this with browser rendering.
- Try increasing delay between requests with
-dflag.
- Default 3-second delay should be sufficient.
- Increase delay if you encounter issues.
MIT License