A Python command-line utility to scrape race results from ZwiftPower, also includes a score calculator for WTRL time trials.
ZwiftPower now requires you to log in with a Zwift account in order to access their data. The WebDriver will wait for you to log in before proceeding to scrape results. Because of this, running with a headless WebDriver no longer works.
Uses the Selenium Python API with the Firefox geckodriver to scrape race results from zwiftpower.
python zwift_scrape.py [url-to-results]
for each passed URL (to a valid zwiftpower results page) the script scrapes the race data and creates two CSVs, one containing the race results for all riders, the other containing the results for the first through and fastest through for each split.python calculate_wtrl_scores.py url-or-filepath
calculates the scores for each rider in a WTRL time trial and saves all riders scores in a CSV. Can be called with either a URL to race results (in which casezwift_scrape
will be used to collect results), or can be called with the filepath to previously scraped CSVs.
Results shown in ./example_ouput/
are generated by running:
python calculate_wtrl_scores.py https://www.zwiftpower.com/events.php?zid=1588142 -s example_output
- Firefox must be installed
- Requires Selenium:
pip install selenium
-s
,--saveName
- Saves output files to a directory with the given name, if not specified the race title given on the webpage will be used.
-s
,--saveName
- As above-p
,--ptsFirst
- Sorts output by score, otherwise output is sorted by finish time.-o
,--onlyScores
- If called with a URL, only the scores will be saved. Otherwise, the results from zwift_scrape will also be saved.-e
,--excludeSplit
- Call with split name to exclude that split from scoring primes. Can be called any number of times.