This is a tool that uses an automated browser to collect all the times for a set of Strava segments completed today, then adds up the times and outputs the results. It is intended to simplify the scoring process for an event like an Enduro, where the goal is to set the lowest cumulative time over a variety of segments on the day.
This is an automated browser that scrapes data off the Strava leaderboards, so please use it responsibly. It logs in to your own account, so what you do will be tied back to you. You also need to be a Strava subscriber to get access to the granular leaderboard data.
- Have Python installed on your system.
- Create a virtual environment, activate it, and install
requirements.txt
- Rename
secrets_template.py
tomy_secrets.py
- Replace the email and password in the environment variables definitions of
my_secrets.py
with your username and password. - Create a .txt file called whatever you want and paste in Strava segment IDs, one per line. After each ID, add a
#
and note what the names of the segments are.- You get the Strava segments by looking at the URL of the segment page. For example, for the UW Arboretum Northbound segment is at
https://www.strava.com/segments/704038
, so the segment ID is704038
- For example, you could have a file called
weekly_shop_ride_sprints.txt
and it would look like this:
29713412 # Rutland-Dunn Kicker 7321846 # Sun Valley - Only Up 10768746 # Krooked Tree Sprint 704038 # UW Arboretum Northbound
- You get the Strava segments by looking at the URL of the segment page. For example, for the UW Arboretum Northbound segment is at
- Run the tool with
python cli.py [OPTIONS]
. Runpython cli.py --help
to get help information about the options. Examples:python cli.py -s ./weekly_shop_ride_sprints.txt
to run the scraper on a list of segments
- Check the
/printouts
folder for the output.
In the /printouts
folder, there's a raw_seconds.csv
that can be useful for validating the math and a by_total_time.csv
which has the riders ranked by total time, and the times formatted into nice hh:mm:ss
. If you're doing prizes on each segment, you can sort this file by the various columns to see the top times for each.
Check your credentials in my_secrets.py
. If it fails repeatedly and your credentials are correct, please open an issue on Github with as many details as possible.
See if the output says it's using cached data. If it is, you can delete the .cache
folder and it will fetch fresh data.
Yeah...If Strava would make this information accessible through the API, this would be much easier and better. Alternatively, they could support this type feature natively on their website. Please give kudos to this suggestion!