From 452a2572fa7a3658ca76d679d3331c41805c5c90 Mon Sep 17 00:00:00 2001 From: cube Date: Sat, 30 May 2026 18:59:12 +0100 Subject: [PATCH] example gives a running timeline checking every 10 seconds --- README.md | 6 +++++- example.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index da2e18c..457b1c5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # 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) diff --git a/example.py b/example.py index feada44..d45f677 100644 --- a/example.py +++ b/example.py @@ -1,4 +1,5 @@ from pcslive import LiveStats +import time stats = LiveStats() @@ -6,6 +7,11 @@ if len(stats.races) > 0: race = stats.races[0] print("Latest timeline update from", race.title, ":") - race.get_timeline() - print(race.timeline[0]) \ No newline at end of file + 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) \ No newline at end of file