some updates from todays racing and functions added for easier timeline use

This commit is contained in:
cube
2026-06-01 16:56:43 +01:00
parent f16e75731c
commit 937b07a61d
4 changed files with 101 additions and 15 deletions

View File

@@ -2,11 +2,9 @@
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.
# todo
- [ ] timeline items with details
- [x] timeline items with details
- [ ] pypi package ??
# setup (windows)
@@ -31,11 +29,14 @@ pip install beautifulsoup4
pip install requests
```
# usage
# examples
```
from pcslive import LiveStats
in any looping example, use a suitable delay to avoid spamming the site with requests
stats = LiveStats()
stats.print_races()
```
`example_latest_timeline.py` : uses a simple infinite loop (async would be better in a full application) to skim the top of the timeline for live updates. it will not display the same update twice
`example_live_timeline.py` : another older way to show a live timeline update, less compatible with async routines due to the checking of the last item
`example_situation.py` : display the provided time gaps (if any) in a readable format
`example_timeline_all.py` : display the entire timeline of a race (at this moment) - in reverse so that the latest update is at the bottom for console convenience