The Amazon Product Scraper is a Python-based tool that uses Selenium to scrape product information from Amazon. It extracts details such as product name, price, availability, and rating, and saves the data into both CSV and HTML files for easy viewing and analysis.
- Scrapes product information from Amazon.
- Extracts product name, price, availability, and rating.
- Saves the scraped data into a CSV file.
- Generates an HTML file to display the scraped data in a table format.
- Uses design patterns (Factory and Strategy) for better code organization and maintainability.
- Error handling implementation
├── browser_factory.py # Contains the BrowserFactory class to initialize web driver instances.
├── scraper.py # Implements the scraping logic using Selenium.
├── utils.py # Utility functions for data processing and file handling.
├── main.py # Entry point of the application; orchestrates the scraping process.
- Clone the repository:
git clone https://github.com/Thejas0604/web-scraper.git cd web-scraper - Create a virtual environment and activate it:
python -m venv .venv .\.venv\Scripts\activate
- Install the required packages:
pip install -r requirements.txt
- Edit
what_to_scrapevariable in themain.pyfile. - Run the scraper:
python main.py
- View the results
The scraped data will be saved in
amazon_products.csv. An HTML file namedamazon_products.htmlwill be generated to display the data in a table format.
- Python
- Selenium
- WebDriver Manager
- ChromeDriver