example gives a running timeline checking every 10 seconds
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
10
example.py
10
example.py
@@ -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)
|
||||||
Reference in New Issue
Block a user