mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 04:06:03 +01:00
Fix mansfield_vic_gov_au (#2096)
* fix mansfield_vic_gov_au * reformatting --------- Co-authored-by: 5ila5 <5ila5@users.noreply.github.com>
This commit is contained in:
@@ -69,10 +69,13 @@ class Source:
|
||||
for article in soup.find_all("article"):
|
||||
waste_type = article.h3.string
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
next_pickup = article.find(class_="next-service").string.strip()
|
||||
if re.match(r"[^\s]* \d{1,2}\/\d{1,2}\/\d{4}", next_pickup):
|
||||
next_pickup = article.find(class_="next-service").string
|
||||
if next_pickup is None:
|
||||
continue
|
||||
date_match = re.search(r"\d{1,2}\/\d{1,2}\/\d{4}", next_pickup)
|
||||
if date_match:
|
||||
next_pickup_date = datetime.strptime(
|
||||
next_pickup.split(sep=" ")[1], "%d/%m/%Y"
|
||||
date_match.group(0), "%d/%m/%Y"
|
||||
).date()
|
||||
entries.append(
|
||||
Collection(date=next_pickup_date, t=waste_type, icon=icon)
|
||||
|
||||
Reference in New Issue
Block a user