Files
pcs_live/README.md
2026-06-01 19:28:23 +00:00

54 lines
1.4 KiB
Markdown

# pcs_live
scrapes procyclingstats livestats homepage and timeline
if running on a vps (or vps-like system such as raspberry pi), it shouldnt 403 anymore
# todo
- [x] timeline items with details
- [ ] pypi package ??
# setup (windows)
after cloning, cd into directory and set up a virtualenv
```
py -3 -m venv .venv
.venv\Scripts\activate
```
if you get an error while activating the virtualenv, you may need to run this first
```
Set-ExecutionPolicy Unrestricted -Force
```
# setup linux
after cloning, cd into directory and create a virtualenv
```
python -m venv venv
source venv/bin/activate
```
# install dependencies
```
pip install beautifulsoup4
pip install requests
pip install cloudscraper
```
# examples
in any looping example, use a suitable delay to avoid spamming the site with requests
`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