This Python project downloads flyers, product images, and saves product data to CSV files from multiple grocery store chains.
Complete Publix weekly ads scraper with store-specific data and flyer images.
Downloads Aldi flyer PDFs, page images, and product data.
git clone https://github.com/mohdtalal3/ads_scraper.git
cd ads_scraperpython3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activatepip install -r requirements.txtDownloads weekly ads, product images, and flyer pages for a specific Publix store.
python3 publix.py-
Prompts for Store Location
- Enter ZIP code (e.g.,
31008) - Enter store name (e.g.,
Publix at Gunn Battle)
- Enter ZIP code (e.g.,
-
Fetches Store-Specific Data
- Automatically cleans store codes (removes
#, adds leading zeros) - Gets campaign ID and promotion details
- Automatically cleans store codes (removes
-
Downloads Content
- Product images (enhanced quality when available)
- Flyer page images (full weekly ad pages)
- CSV data with product details
-
Retry Mechanism
- Automatically retries failed downloads up to 3 times
- Shows progress for each image downloaded
publix/
βββ Publix_Weekly Ad_10-08-25_10-14-25/
β βββ Publix_Weekly Ad_10-08-25_10-14-25.csv
β βββ PUBLIX_251009_item123_456.jpg (product images)
β βββ PUBLIX_251009_item789_012.jpg
β βββ Publix_Weekly Ad_10-08-25_10-14-25_flyer_page1.jpg (flyer pages)
βββ Publix_Extra Savings_10-09-25_10-15-25/
βββ Publix_Extra Savings_10-09-25_10-15-25.csv
βββ ...
flyer_id- Weekly ad identifierflyer_name- Promotion type (e.g., "Weekly Ad", "Extra Savings")id- Product/deal IDname- Product nameprice- Savings amountdescription- Product descriptionadditional_deal_info- Extra deal informationvalid_from- Start date (MM-DD-YY)valid_to- End date (MM-DD-YY)image- Local product image filename
- β
Smart Store Code Handling: Removes
#and formats codes properly - β Enhanced Images: Prioritizes high-quality enhanced images
- β Clean Filenames: IDs are sanitized (dashes β underscores)
- β Retry Logic: 3 automatic retries for failed downloads
- β Progress Tracking: Real-time download status
- β Multiple Promotions: Handles Weekly Ad, Extra Savings, and more
Downloads Aldi flyer PDFs, page images, and product data.
python3 aldi_scraper.py- Fetches available Aldi flyers
- Downloads flyer PDFs (if available)
- Downloads flyer page images
- Downloads product images
- Saves product metadata to CSV
Aldi_<flyer_name>/
βββ <flyer_base>_flyer.pdf
βββ <flyer_base>_page_1.jpg
βββ <flyer_base>_page_2.jpg
βββ <flyer_id>_<product_id>.jpg
βββ <flyer_base>_products.csv
- π₯ Automatic Downloads: Fetches all available images and data
- π Retry Mechanism: 3 automatic retries for failed downloads
- π Progress Indicators: Real-time download status
- π Organized Output: Clean folder structure per flyer
- π CSV Export: All product data saved in structured format
- πΌοΈ Image Management: Downloads and organizes all images
- πͺ Store Locator: Find stores by ZIP code and name
- π― Store-Specific Ads: Get deals for your local store
- π Enhanced Images: Prioritizes high-quality product images
- ποΈ Multiple Promotions: Handles all active promotions
- π€ Clean Naming: Sanitized filenames with underscores
ads_scraper/
βββ publix.py # Publix scraper (recommended)
βββ aldi_scraper.py # Aldi scraper
βββ test.py # Development/testing file
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ publix/ # Output folder (auto-created)
βββ ...
- Store codes are automatically cleaned and formatted
#1219β01219- Leading zeros added for 4-digit codes
- Publix: Automatically uses
enhancedImageUrlwhen available - Falls back to standard
imageUrlif enhanced not available
- Verify ZIP code is correct
- Try a nearby ZIP code
- Check internet connection
- Some images may be temporarily unavailable
- Script will continue with other images
- CSV will show empty
imagefield for failed downloads
- Script automatically handles
#prefix - Ensures proper 5-digit format with leading zeros
- Rate Limiting: Script includes timeouts to respect server limits
- Data Accuracy: Always verify prices and dates in-store
- Image Rights: Images are property of respective stores
- Personal Use: Intended for personal use only
Feel free to submit issues or pull requests for:
- Additional store support
- Bug fixes
- Feature improvements
- Documentation updates
This project is for educational and personal use only. All store names, logos, and content are property of their respective owners