joenano / rpscrape

Scrape horse racing results data and racecards.
146 stars 60 forks source link

error on racecards.py tomorrow call #69

Closed HyperFail closed 3 years ago

HyperFail commented 3 years ago

Hello @4A47,

When running a call to racecards.py tomorrow in order to pull saturday 18th cards, I'm receiving the below error:

Traceback (most recent call last): File "C:\horses\scripts\racecards.py", line 413, in main() File "C:\horses\scripts\racecards.py", line 403, in main races = parse_races(session, race_docs, date) File "C:\horses\scripts\racecards.py", line 318, in parse_races runners = get_runners(profile_urls, race['race_id']) File "C:\horses\scripts\racecards.py", line 135, in get_runners json_str = doc[1].xpath('//body/script')[0].text.split('window.PRELOADED_STATE =')[1].split('})()')[0].strip().strip(';')

IndexError: list index out of range

joenano commented 3 years ago

It was a random broken url, fixed now but obviously some normal information will not be available for the specific runner.