Files
pcs_live/README.md

52 lines
1.3 KiB
Markdown
Raw Normal View History

2026-05-30 15:58:26 +00:00
# pcs_live
scrapes procyclingstats livestats homepage and timeline
2026-05-30 22:24:58 +00:00
# todo
- [x] timeline items with details
2026-05-30 22:25:59 +00:00
- [ ] pypi package ??
2026-05-30 18:39:09 +01:00
# setup (windows)
2026-06-01 20:27:15 +01:00
after cloning, cd into directory and set up a virtualenv
2026-05-30 18:39:09 +01:00
```
py -3 -m venv .venv
.venv\Scripts\activate
```
2026-05-30 19:56:39 +00:00
if you get an error while activating the virtualenv, you may need to run this first
2026-05-30 18:39:09 +01:00
```
Set-ExecutionPolicy Unrestricted -Force
```
2026-06-01 20:27:15 +01:00
# setup linux
after cloning, cd into directory and create a virtualenv
```
python -m venv venv
source venv/bin/activate
```
# install dependencies
2026-05-30 18:39:09 +01:00
```
pip install beautifulsoup4
pip install requests
2026-06-01 20:27:15 +01:00
pip install cloudscraper
2026-05-30 18:39:09 +01:00
```
# examples
2026-05-30 18:39:09 +01:00
in any looping example, use a suitable delay to avoid spamming the site with requests
2026-05-30 18:39:09 +01:00
`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