Read the current OneDrive link from the stat-check.com/elo iframe on each run, falling back to EMBED_URL if the page can't be read or its link 404s. Retry 429/5xx and network errors up to three times with backoff, after a one-off 503 from the Badger token endpoint failed a run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.3 KiB
Stat Check Elo Scraper
This is a pure-Python scraper for the public Excel workbook embedded at:
https://www.stat-check.com/elo
It does not need Selenium, Playwright, Chromium, pandas, or openpyxl. It uses only the Python standard library.
How It Works
The Stat Check page embeds a public OneDrive Excel workbook through a 1drv.ms URL. Microsoft's web viewer does not expose a stable direct .xlsx URL in the page HTML, but it does use a public OneDrive metadata API behind the scenes.
The scraper reproduces the useful part of that flow:
- Read the current
1drv.msembed link from the Stat Check page's iframe. Stat Check replaces this link occasionally, so it is looked up on every run;EMBED_URLinpure_python_elo_scrape.pyis only a fallback for when the page can't be read or its link returns 404. - Request an anonymous Microsoft "Badger" token from:
https://api-badgerp.svc.ms/v1.0/token - Convert the public OneDrive embed URL into Microsoft Graph's
shares/u!...id format. - Call:
https://my.microsoftpersonalcontent.com/_api/v2.0/shares/{share_id}/driveItem?action=EmbedViewwithAuthorization: Badger <token>. - Read
@content.downloadUrlfrom the metadata response. - Download the real
.xlsx. - Convert the first worksheet to CSV by reading the XLSX ZIP/XML structure directly.
The Microsoft endpoints used here are undocumented and could change, but this currently works without browser automation.
Requests that fail with HTTP 429, a 5xx status, or a network error are retried up to three times (after 5, 15 and 45 seconds).
Usage
python3 pure_python_elo_scrape.py
Default outputs:
elo-pure.xlsxelo-pure.csv
You can also pass output paths:
python3 pure_python_elo_scrape.py statcheck-elo.xlsx statcheck-elo.csv
Files
pure_python_elo_scrape.py- gets the Badger token, resolves the workbook download URL, downloads the XLSX, writes CSV.download_and_parse.py- helper functions for downloading and converting XLSX to CSV with stdlib only.sample-elo.csv- sample output captured during testing.
Verification From Testing
On June 28, 2026, this downloaded a 3,465,320 byte workbook and produced a 4,145,399 byte CSV with 40,945 rows. The CSV header was:
Rank,Delta,Name,W,L,D,G,WR%,Elo,Delta,Last Event,Country