This Python script is used for web scraping book data from a specified URL and saving it to a CSV file.
-
Ensure you have the required libraries installed. You can install them using pip:
pip install selenium pandas
-
Configure the script with the necessary details:
FILENAME
: Name of the CSV file to store the scraped data.COLUMNS
: Column names for the CSV file.START_ROW_NUM
: The starting row number to begin data retrieval.HEADER
: HTTP request headers for the web scraping requests.url
: The URL of the book product page you want to scrape.
-
Run the script:
python script.py
-
The script will open a web browser, navigate to the specified URL, and scrape the book data, including title, author, URL, description, details, price, discount, discounted price, and image URL.
-
The scraped data will be saved to a CSV file named
data.csv
(you can change the file name in the script). -
The script will handle multiple URLs by reading them from a CSV file and scraping data for each URL.
- Python 3.x
- Selenium
- Pandas
This script is provided under the MIT License.
You can customize the script and README.md file as needed, and use it to scrape book data from different URLs and store it in a CSV file.