Skip to main content

HLTV CS2 match data crawler — scrape matches, maps, player stats to SQLite

Project description

HLTV CS2 Crawler

CS2 match data crawler — scrape HLTV matches, maps, player stats to SQLite.

Features

  • Cloudflare bypass via curl_cffi (Chrome 124 impersonation)
  • Disk cache — avoid re-downloading (24h TTL)
  • Rate limiting — 2s between requests
  • Pagination — auto-scroll through results pages
  • Date/event filtering — scrape only what you need
  • Resume support — stop and continue later (via progress.json)
  • Zero external deps for storage — SQLite is Python stdlib

Quick Start

# 1. Install
git clone git@github.com:kongerly/hltv-crawler.git
cd hltv-crawler
python -m venv .venv
.venv\\Scripts\\activate      # Windows
pip install -r requirements.txt

# 2. Crawl (use --max-pages first to test)
python crawl.py --max-pages=3

# 3. More examples
python crawl.py --max-pages=10 --start-date=2025-01-01
python crawl.py --event="IEM" --max-pages=5
python crawl.py --resume                      # Continue from last time

Output

  • data/hltv.db — SQLite database with 6 tables
  • data/raw/*.html — cached HTML pages (can be deleted safely)

Database tables

Table Description
events Tournaments & events
teams Team rankings
players Player roster info
matches Match results (bo, scores, winner)
maps Per-map scores + CT/T side rounds
player_match_stats Per-player stats (rating, ADR, KAST, K/D)

Requirements

  • Python 3.10+
  • curl_cffi — HTTP client with TLS fingerprint spoofing
  • beautifulsoup4 — HTML parsing

Use as a Library

from pathlib import Path
from storage import Database
from scraper import HltvOrchestrator

with Database(Path("data/hltv.db")) as db:
    db.create_tables()
    with HltvOrchestrator(db) as orch:
        counts = orch.run_full_pipeline(max_pages=5)
        print(counts)

License

MIT

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

hltv_crawler-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

File details

Details for the file hltv_crawler-0.1.0.tar.gz.

File metadata

  • Download URL: hltv_crawler-0.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for hltv_crawler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c33c315da09e96b4384641a89c490bcfb133a2a9412d002cdb20c5ed7287e700
MD5 0218f2a7f847a02bf2cf3a15ceddf0cf
BLAKE2b-256 f6f7e9414d4a36cdd32f32a0d87af2fe87af0dfe5ce12cd014f2d252b6cb140f

See more details on using hashes here.

Supported by

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