example gives a running timeline checking every 10 seconds

This commit is contained in:
cube
2026-05-30 18:59:12 +01:00
parent 57a6ebbf35
commit 452a2572fa
2 changed files with 13 additions and 3 deletions

View File

@@ -1,6 +1,10 @@
# pcs_live # pcs_live
scrapes procyclingstats livestats for use elsewhere 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) # setup (windows)

View File

@@ -1,4 +1,5 @@
from pcslive import LiveStats from pcslive import LiveStats
import time
stats = LiveStats() stats = LiveStats()
@@ -6,6 +7,11 @@ if len(stats.races) > 0:
race = stats.races[0] race = stats.races[0]
print("Latest timeline update from", race.title, ":") print("Latest timeline update from", race.title, ":")
race.get_timeline()
print(race.timeline[0]) last_update = ""
while True:
race.get_timeline()
if last_update != race.timeline[0]:
print(race.timeline[0])
last_update = race.timeline[0]
time.sleep(10)