For-The-Wolf / zwift-scrape

Scrape race results from www.zwiftpower.com, also includes a score calculator for WTRL time trials.
GNU General Public License v3.0
9 stars 2 forks source link

zwift-scrape

A Python command-line utility to scrape race results from ZwiftPower, also includes a score calculator for WTRL time trials.

!! Recent changes to ZwiftPower

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.

Description

Uses the Selenium Python API with the Firefox geckodriver to scrape race results from zwiftpower.

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

Requirements

  1. Firefox must be installed
  2. Requires Selenium: pip install selenium

Optional command-line arguments

zwift_scrape

  1. -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.

calculate_wtrl_scores

  1. -s, --saveName - As above
  2. -p, --ptsFirst - Sorts output by score, otherwise output is sorted by finish time.
  3. -o, --onlyScores - If called with a URL, only the scores will be saved. Otherwise, the results from zwift_scrape will also be saved.
  4. -e,--excludeSplit - Call with split name to exclude that split from scoring primes. Can be called any number of times.