This project is a parser for the steam market of such games as CS 2, Team Fortress 2, Dota 2, PUBG, RUST, etc.
This guide describes the steps to install and run the project on Linux and Windows.
Before you start, make sure that the following components are installed on your system:
- Python 3 (check with
python3 --version
Linux /python --version
Windows)
- pip (check with
pip --version
) - Git (check with
git --version
) - Python Virtual Environment (venv)
- Linux Shell (for example, Bash)
Clone the project repository using Git:
git clone https://github.com/RandomProgramm3r/Steam-Market-Scraper
Create a virtual environment using the venv
command, which allows you to isolate project dependencies:
python3 -m venv venv # Linux
python -m venv venv # Windows
Activate the virtual environment:
source venv/bin/activate # Linux
source venv/Scripts/activate # Windows
Install the dependencies for local development:
pip install -r requirements.txt
For code consistency and quality checks, use Ruff - a unified linter/formatter:
# Run linting checks.
ruff check .
# Auto-fix fixable lint issues
ruff check . --fix
# Format code.
ruff format .
A market_scraper function retrieves pricing information for a specified item from the Steam Community Market.
It constructs the request URL using the item name, Steam application ID, and the desired currency, the fetches and decodes the JSON response.
the list of all available currencies is stored in data.py, as well as a list with some games from steam. (you can add your own games)
import data
def market_scraper(
item_name: str,
app_id: int,
currency: int = data.Currency.USD.value,
) -> str:
pass
import data
import scraper
# Example usage: Fetch price information for 'Dreams & Nightmares Case' in USD for the CS2 app.
# see more in examples.py
print(
scraper.market_scraper(
'Dreams & Nightmares Case',
data.Apps.CS2.value,
data.Currency.USD.value,
),
)
{
"success": true,
"lowest_price": "$1.90",
"volume": "77,555",
"median_price": "$1.90"
}