This is a simple Python script that demonstrates web scraping using the BeautifulSoup library. The script retrieves game information from the OpenCritic website, including the game name, rating, supported platforms, release date, and image URL.
The script prompts the user to enter the number of pages they want to scrape from the OpenCritic website. It then sends HTTP requests to the corresponding page URLs, retrieves the HTML content, and uses BeautifulSoup to parse the HTML and extract the desired game information.
For each game found on the scraped pages, the script collects the relevant details and stores them in a JSON file named data.json. The JSON file serves as a structured data representation of the scraped game information.
-
Clone the repository:
git clone https://github.com/your-username/basic-web-scraping.git
-
Install dependencies:
pip install -r requirements.txt
-
Run the Script:
python3 scraping.py
-
Enter the number of pages to be scraped when prompted.
-
The script will scrape the specified number of pages from the OpenCritic website and save the game information in a JSON file named data.json