|
|
@@ -22,19 +22,23 @@ RaceDay = collections.namedtuple('RaceDay', RaceDayShort._fields + (
|
|
|
Scratching = collections.namedtuple('Scratching', 'venue date race horse')
|
|
|
|
|
|
|
|
|
-def get_today_row(this_text):
|
|
|
+def get_today_row(this_text, this_row):
|
|
|
"""
|
|
|
Traverses the main table on the front page of https://racingaustralia.horse.
|
|
|
This function scrapes Venue information and race day information.
|
|
|
Unfortunately there is no clever way to split this function into two parts.
|
|
|
:param this_text:
|
|
|
+ :param this_row:
|
|
|
:return RaceDay this_race_day:
|
|
|
"""
|
|
|
this_soup = BeautifulSoup(this_text, 'html.parser')
|
|
|
rows = this_soup.select('tr.rows')
|
|
|
# print('len(rows) {}'.format(len(rows)))
|
|
|
all_race_days = []
|
|
|
- for day in range(len(rows)):
|
|
|
+ days_to_check = [this_row]
|
|
|
+ if this_row == 0:
|
|
|
+ days_to_check = range(len(rows))
|
|
|
+ for day in days_to_check:
|
|
|
my_row = rows[day]
|
|
|
cells = my_row.select('td')
|
|
|
i = 0
|
|
|
@@ -110,7 +114,7 @@ def get_meta_data(this_data, this_venue):
|
|
|
match = close_regex.search(this_meta_data)
|
|
|
if match:
|
|
|
# print(match[1])
|
|
|
- times[2] = match[1][:-5]
|
|
|
+ times[2] = match.group(1)[:-5]
|
|
|
l_time = datetime.datetime.strptime(times[2], time_format)
|
|
|
# print(aest.localize(l_time))
|
|
|
times[3] = model.convert_to_unixtime(aest.localize(l_time))
|