A Python web scraper designed to extract product data from Altman.co.il online store. This tool crawls through the shop pages and extracts detailed product information including titles, descriptions, prices, and images.
- Smart Crawling: Automatically discovers and crawls product pages
- Product Data Extraction: Extracts titles, names, descriptions, prices, and images
- Resume Capability: Skips already crawled URLs in subsequent runs
- Shop-Only Focus: Only crawls URLs containing
/shop/to avoid irrelevant pages - JSON Output: Saves structured data in JSON format
- Hebrew Support: Properly handles Hebrew text content
- Progress Tracking: Shows real-time crawling progress
- Error Handling: Robust error handling and recovery
- Python 3.7+
- Windows/Linux/MacOS
- Internet connection
-
Clone the repository:
git clone https://github.com/yourusername/altman-scraper.git cd altman-scraper -
Run the setup script:
setup.bat
-
Clone the repository:
git clone https://github.com/yourusername/altman-scraper.git cd altman-scraper -
Install Python dependencies:
pip install -r requirements.txt
-
Install Playwright browsers:
playwright install
Run the scraper with default settings (25 pages):
python alt_scan_v01.pyπ·οΈ Altman.co.il Product Scraper
============================================================
π Configuration:
β’ Max pages to crawl: 25
β’ Max depth: 15
β’ Starting URL: https://www.altman.co.il/shop/
β’ Crawled URLs file: crawled_urls.json
============================================================
Loaded 0 previously crawled URLs
Crawling: https://www.altman.co.il/shop/ (depth: 0)
β Product data saved to www_altman_co_il/magnesium_up_60_product_data.json
Product: ΧΧΧ ΧΧΧΧ UP - Magnesium UP
Price: βͺ 110.80
Unit Price: βͺ 1.85
Images found: 4
Description: ΧΧΧ ΧΧ ΧΧΧΧ Χ©Χ 450 Χ"Χ ΧΧΧ ΧΧΧΧ ΧΧΧΧΧͺΧ ΧΧΧΧ€Χ§ ΧΧΧ’ΧΧΧΧͺ ΧΧΧ ΧΧΧΧ...
You can modify the scraper behavior by editing the configuration variables at the top of alt_scan_v01.py:
# CONFIGURATION SETTINGS - Update these values as needed
MAX_PAGES = 25 # Change this number to crawl more or fewer pages
MAX_DEPTH = 15 # Maximum depth to crawl (how many clicks deep from start page)
START_URL = "https://www.altman.co.il/shop/" # Starting URL for crawling
# File to store crawled URLs across runs (to avoid re-crawling)
CRAWLED_URLS_FILE = "crawled_urls.json"| Variable | Description | Default | Example Values |
|---|---|---|---|
MAX_PAGES |
Number of pages to crawl per session | 25 |
10, 50, 100 |
MAX_DEPTH |
Maximum clicks deep from start page | 15 |
5, 10, 20 |
START_URL |
URL to start crawling from | "https://www.altman.co.il/shop/" |
Any shop URL |
CRAWLED_URLS_FILE |
File to store crawled URLs | "crawled_urls.json" |
"progress.json" |
Crawl only 10 pages:
MAX_PAGES = 10Start from a specific category:
START_URL = "https://www.altman.co.il/shop/vitamins/"Use a different progress file:
CRAWLED_URLS_FILE = "my_crawling_progress.json"The scraper creates the following file structure:
your-project/
βββ www_altman_co_il/ # Main output directory
β βββ product1_product_data.json
β βββ product2_product_data.json
β βββ category_general_content.json
βββ crawled_urls.json # Progress tracking file
βββ alt_scan_v01.py # Main scraper script
βββ requirements.txt # Dependencies
Each product JSON file contains:
{
"url": "https://www.altman.co.il/shop/magnesium/magnesium-up-60/",
"timestamp": "2025-01-07T15:13:33.005354",
"product_title": "ΧΧΧ ΧΧΧΧ UP",
"product_name": "Magnesium UP",
"description": "ΧΧΧ ΧΧ ΧΧΧΧ Χ©Χ 450 Χ\"Χ ΧΧΧ ΧΧΧΧ ΧΧΧΧΧͺΧ ΧΧΧΧ€Χ§ ΧΧΧ’ΧΧΧΧͺ ΧΧΧ ΧΧΧΧ ΧΧͺΧΧ‘Χ€Χͺ ΧΧ©ΧΧΧ ΧΧ€Χ’ΧΧΧΧͺ ΧΧ©ΧΧΧΧ.",
"total_price": "βͺ 110.80",
"price_per_unit": "βͺ 1.85",
"image_links": [
"https://www.altman.co.il/wp-content/uploads/batch_images/image1.webp",
"https://www.altman.co.il/wp-content/uploads/batch_images/image2.webp"
]
}The scraper automatically saves progress and can resume from where it left off:
- First run: Crawls up to 25 new pages
- Second run: Skips already crawled URLs, crawls 25 more new pages
- Progress file:
crawled_urls.jsontracks all crawled URLs
To start fresh and re-crawl all pages:
# Delete the progress file
rm crawled_urls.json
# Or on Windows:
del crawled_urls.json
# Then run the scraper
python alt_scan_v01.pyIssue: playwright._impl._errors.Error: Executable doesn't exist
# Solution: Install Playwright browsers
playwright installIssue: ModuleNotFoundError: No module named 'crawl4ai'
# Solution: Install dependencies
pip install -r requirements.txtIssue: Empty image_links in output
- This might be normal for some pages
- Images are filtered to exclude icons and theme assets
- Check if the page actually contains product images
Issue: total_price shows "βͺ 0"
- The price pattern might need adjustment for specific products
- Some products might not have prices displayed
- Check the HTML structure of problematic pages
To see more detailed output, you can modify the crawler settings in the code:
# In the crawler.arun() call, change:
verbose=True # Already enabled for debug output- Speed: ~3-5 seconds per page (due to JavaScript loading delay)
- Memory: Minimal memory usage as data is saved to files immediately
- Storage: Each product JSON is typically 1-3 KB
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This scraper is for educational and research purposes. Please ensure you comply with:
- Altman.co.il's Terms of Service
- robots.txt file
- Rate limiting (scraper includes delays)
- Data usage regulations
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter issues:
- Check the Troubleshooting section
- Ensure all dependencies are installed correctly
- Verify your internet connection
- Check that the target website is accessible
For bugs or feature requests, please open an issue on GitHub.
Happy Scraping! π