Skip to main content

A tool to check game prices from GOG API

Project description

Game Price Checker 💵

PyPI Latest build status

The Game Price Checker is a Python script that allows you to extract a URL from the clipboard, download the web page content, and retrieve the price of a game from the GOG API. The script is designed to work on macOS systems.

Requirements

  • Python 3.x
  • Requests library (for making HTTP requests)
  • Regular expressions (re) module
  • Threading module (for concurrent requests)
  • Logging module (for logging)

Installation

pip install gog-price-checker

How to Use

  1. Copy a URL containing a game page (e.g., https://www.gog.com/game/diablo) to the clipboard.

  2. Run the Python script with the following arguments:

    • -u, --url: The URL of the game page to scrape (required).
    • -n, --normalize: (Optional) Normalize currencies to USD.
    • -c, --count : (Optional) default = 10, number of countries to show in sorted prices result
    • -p, --pretty : (Optional) shows result as pretty table

Example:

gog-price-checker -u https://www.gog.com/game/diablo -n -p

Output:

Country                   Price      Currency
---------------------------------------------
Ukraine                   5.51       USD
Moldova                   5.51       USD
Kazakhstan                5.51       USD
Armenia                   5.51       USD
China                     5.57       USD
Poland                    8.34       USD
Australia                 9.24       USD
New Zealand               9.24       USD
Andorra                   9.99       USD
Spain                     9.99       USD
Sweden                    9.99       USD
...
  1. The script will download the web page, extract the product ID, and fetch the price from the GOG API for multiple countries concurrently using threads.

  2. The prices for different countries will be displayed in descending order of value. If the -n flag is provided, the prices will be normalized to USD.

Limitations

  • The script uses regular expressions to extract the product ID and prices, which might not handle all possible web page structures or API responses. Some pages may require additional parsing logic.
  • The API endpoint used to fetch prices is specific to GOG, and it may change over time. Ensure the API remains accessible and the script is updated accordingly.

Important Note

  • The script is provided as-is, and it is advisable to use it responsibly and in accordance with the website's terms of use. Automated scraping of websites can put a strain on their servers, so use the script with caution and avoid making excessive requests.

Credits

  • This script is provided as an educational example and is not intended for commercial purposes. It was created as part of a task and is not an official GOG product.

License

  • The Game Price Checker Python script is released under the MIT License. Feel free to modify and distribute the script according to the terms of the license.

Disclaimer

  • The author of this script is not responsible for any misuse or consequences of using the script on unauthorized websites. Always make sure you have the right to access and use the data from the websites you interact with.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gog-price-checker-1.0.0.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

gog_price_checker-1.0.0-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page