Cross-Platform iPhone Marketplace Intelligence
A Python client to scrape, parse, and analyze iPhone listings from multiple marketplaces (OLX India, Facebook Marketplace) with AI-powered data extraction.
- Multi-Platform Scraping: OLX India + Facebook Marketplace
- AI-Powered Parsing: Gemini 2.0 Flash extracts iPhone specs from unstructured text
- Structured Data Extraction:
- Series, Model, Storage, Color
- Battery Health, Warranty info
- Seller details, Price, Location
- Smart Filtering: 1-day, 3-day, 5-day, 7-day inventory age filters
- Export: CSV and JSON formats
- Cities Supported: Chennai, Bangalore, Coimbatore
git clone https://github.com/Vi-Sri/Tetro-Stack.git
cd Tetro-Stack
pip install -r requirements.txtCreate env.sh with your API keys:
#!/bin/bash
export APIFY_API_TOKEN="your_apify_token_here"
export GEMINI_API_KEY="your_gemini_api_key_here"Then source it:
source env.sh# Full cross-platform scrape (OLX + Facebook)
python test_ensemble.py
# Token validation & cached data (no credits used)
python test_integration.py
# Test AI parser only
python test_gemini_parser.py- Sign up at apify.com
- Go to Settings → Integrations
- Copy your API token
- Add payment method for paid actors
Actors Used:
natanielsantos/olx-india-scraper(OLX India)curious_coder/facebook-marketplace(Facebook Marketplace)
- Go to Google AI Studio
- Create API key
- Model used:
gemini-2.0-flash
tetro_stack/
├── clients/
│ ├── apify_client.py # Apify scraper integration
│ ├── platforms.py # Platform configs (OLX, FB)
│ └── base_client.py # Abstract base client
├── models/
│ └── iphone_listing.py # Pydantic data models
├── parsers/
│ └── iphone_parser.py # Gemini AI + regex parsing
├── filters/
│ └── inventory_filter.py # Age-based filtering
├── exporters/
│ └── data_exporter.py # CSV/JSON export
└── config.py # Configuration
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Model ┃ Storage ┃ Price ┃ City ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ iPhone 14 Pro Max │ 128GB │ ₹54,500 │ Bengaluru, KA │
│ iPhone 13 │ 128GB │ ₹27,000 │ Chennai, TN │
│ iPhone 12 Pro │ 256GB │ ₹26,000 │ Bengaluru, KA │
│ iPhone 11 │ 64GB │ ₹14,500 │ Coimbatore │
└───────────────────┴─────────┴──────────┴───────────────┘
| Field | Description |
|---|---|
series |
iPhone generation (11, 12, 13, 14, 15, 16) |
model |
Specific model (Pro, Pro Max, Plus, Mini) |
storage |
Capacity (64GB, 128GB, 256GB, 512GB, 1TB) |
color |
Device color |
battery_health |
Battery percentage if available |
warranty |
Warranty status and type |
price |
Listed price in INR |
seller.city |
Seller location |
days_active |
Days since listing was posted |
source |
Platform (olx_india, facebook_marketplace) |
- ~240 listings per run (100 OLX + 140 Facebook)
- ~55 seconds total scrape time
- 3 cities searched simultaneously
- AI parsing with regex fallback
- Listings older than 5 days are filtered out (iPhones move fast!)
- Facebook Marketplace doesn't expose seller names in search results
- Gemini free tier has rate limits; falls back to regex when exceeded