Files
pcs_live/README.md
2026-05-30 20:52:47 +01:00

45 lines
1.2 KiB
Markdown

# pcs_live
scrapes procyclingstats livestats homepage and timeline
timeline updates are simply the titles, so sometimes you get something like "ranking after x km" or "present riders today from last years top 20" with no details. for now i am not getting the details from underneath, because for the most part they can be ignored. the action timeline headings like "wheel change for x rider" are good enough when they come through.
will try to get situation feed next, although it is not always visible so a challenge...
# setup (windows)
after cloning set up a virtualenv
```
py -3 -m venv .venv
.venv\Scripts\activate
```
you may need to run this first before activating the virtualenv
```
Set-ExecutionPolicy Unrestricted -Force
```
install dependencies
```
pip install beautifulsoup4
pip install requests
```
# usage
```
from pcslive import LiveStats
stats = LiveStats()
stats.print_races()
```
# examples
`example.py` posts the latest timeline of one current race (checking every 10 seconds for updates)
`example2.py` organises the situation diagram in a dictionary of timegap keys to a list of riders in that group. it could probably be organised better but it works