Menu
- Usage cases
- Installation
- Commands
- One book scraping
- One category scraping
- All categories scraping
The Target Website used for this script is https://books.toscrape.com/
- scrape information for ONE BOOK
- scrape information for ONE CATEGORY OF BOOK
- scrape information for ALL CATEGORIES OF BOOKS
- scrape BOOK IMAGE OF EACH PRODUCT PAGE VISITED
You need to have Python installed on your machine. This script has been developed using python 3.9.2. Check your version of Python, if needed, upgrade your version.
Open a terminal in the folder of your choice, then type:
git clone https://github.com/RafaRemote/pythonWebScraper.git
python -m venv env
source env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
Now you can use the commands below in the terminal
In the terminal, check that you are in the folder 'pythonWebScraper', and enter:
python scrape.py
Then simply answer the questions as specified.
- scrape information for one book,
- scrape book image of each product page visited.
will extract the following data:
- product_page_url
- universal_ product_code (upc)
- title
- price_including_tax
- price_excluding_tax
- number_available
- product_description
- category
- review_rating
- image_url
⬇️ data
⬇️ one_book_data
⬇️ [name of the book chosen]
-> csv
-> cover_image
- scrape information for one category of book
- scrape book image of each product page visited
will write all the data (the 10 data listed above) of each book for one category,
⬇️ data
⬇️ one_category_data
⬇️ [name of the chosen category]
-> cover_images
-> csv
- scrape information for all categories of books
- scrape book image of each product page visited
will extract all the information for each book of each category.
⬇️ data
⬇️ all_categories_data
⬇️ [name of the category]
-> cover_images
-> csv
⬇️ [name of the category]
-> cover_images
-> csv
⬇️ [name of the category]
-> cover_images
-> csv
(...etc, up to the 50 categories)