Skip to content

About

OpenClassrooms. Python Developer Path. Project 2: Market Analysis

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Project: Price Scraping

Menu

  1. Usage cases
  2. Installation
  3. Commands
  4. One book scraping
  5. One category scraping
  6. All categories scraping

The Target Website used for this script is https://books.toscrape.com/

1 - Usage cases

  • 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

2 - Installation

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

3 - Commands

In the terminal, check that you are in the folder 'pythonWebScraper', and enter:

python scrape.py

Then simply answer the questions as specified.

4 - One book scraping

Usage cases

  • 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

structure of the data downloaded

⬇️ data

    ⬇️ one_book_data

        ⬇️ [name of the book chosen]

            -> csv
            -> cover_image

5 - One category scraping

Usage cases

  • 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,

structure of the data downloaded

⬇️ data

    ⬇️ one_category_data

        ⬇️ [name of the chosen category]

            -> cover_images
            -> csv

6 - All categories

Usage cases

  • 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.

structure of the data downloaded

⬇️ 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)

About

OpenClassrooms. Python Developer Path. Project 2: Market Analysis

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages