Fix end time parsing
@@ -151,8 +151,15 @@ class DetCityMixin:
"""Parse the end datetime, returning a boolean indicating whether it was scraped"""
time_str = ''.join(response.css('article.time::text').extract()).strip()
time_split = re.split(r'-|(?<=m)\s+(?=\d)', time_str)
+ apm_match = re.search(r'[ap]m{2}', time_split[0].replace('.', ''))
if len(time_split) > 1:
end_str = time_split[1].strip()
+ end_num = re.search(r'[\d:]+', end_str).group()
+ if apm_match and not re.search(r'[apm]{2}', end_str.replace('.', '')):
+ end_str = end_num + apm_match.group()
+ else:
+ end_int = int(re.search(r'\d+', end_str).group())
+ end_str = end_num + ('pm' if end_int < 8 else 'am')
return (
datetime.combine(start.date(), self._parse_time_str(end_str)),
True,
