This Python web_scraping allows you to scrape product data from a list of URLs provided in a CSV file. The web_scraping is designed to be flexible, allowing you to specify the HTML tags and class names for extracting the product name, product price, and product description from web pages.
Before using this web_scraping, you should have the following prerequisites installed:
- Python 3.9
requestslibrary (for making HTTP requests)beautifulsoup4library (for parsing HTML)- A CSV file (
links.csv) containing a list of product URLs to scrape.
-
Clone this repository to your local machine.
-
Install the required Python libraries if you haven't already:
pip install requests beautifulsoup4
-
Create a CSV file named
links.csvin the same directory. Add a list of product URLs that you want to scrape in a single column. -
Run the web_scraping using the following command:
python web_scraping.py
-
The web_scraping will prompt you to enter the HTML tags and class names for the product name, product price, and product description. Provide the required information as requested.
-
The web_scraping will start scraping data from the provided URLs and save the results to an
output.csvfile. -
Once the web_scraping finishes, you can find the scraped data in the
output.csvfile in the same directory.
You can customize the web_scraping by specifying the HTML tags and class names for the product information fields (name, price, description) directly in the web_scraping. Alternatively, you can follow the prompts during web_scraping execution to customize on the fly.
https://example.com/product1
https://example.com/product2
https://example.com/product3
- This web_scraping was created for educational purposes and can be adapted for various web scraping tasks.
- Make sure to respect the website's terms of service and robots.txt file when scraping data from websites.
Happy scraping!