in case there are no live races dont error

This commit is contained in:
cube
2026-05-30 22:00:59 +01:00
parent 1e665d45b7
commit 04dcb8c876

View File

@@ -4,6 +4,7 @@ import requests, time
# class for storing the live races # class for storing the live races
class LiveStats: class LiveStats:
def __init__(self): def __init__(self):
self.races = []
self.refresh_races() self.refresh_races()
# scrapes from the PCS homepage where the little green live stats boxes are # scrapes from the PCS homepage where the little green live stats boxes are
@@ -18,6 +19,8 @@ class LiveStats:
# races are currently live # races are currently live
live = soup.find(attrs={"class":"hp3-livestats"}) live = soup.find(attrs={"class":"hp3-livestats"})
# if there are even any races:
if live:
# also get rid of the horrible polygon number stuff !!! YUCK # also get rid of the horrible polygon number stuff !!! YUCK
# i imagine its how the profiles are drawn. there is A LOT # i imagine its how the profiles are drawn. there is A LOT
# and it makes reading the raw html very PAINFUL # and it makes reading the raw html very PAINFUL