mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 02:04:22 +01:00
fix portenf_sa_gov_au
failed when month div above calendar would show only one month (July 2024) instead of a month range like: July - May 2024
This commit is contained in:
@@ -155,9 +155,14 @@ class Source:
|
||||
soup = BeautifulSoup(r.text, "html.parser")
|
||||
cal_header = soup.find("th", {"class": "header-month"}).find("span").text
|
||||
|
||||
from_month = cal_header.split("-")[0].strip()
|
||||
to_month = cal_header.split("-")[1].strip().split(" ")[0]
|
||||
to_year = from_year = cal_header.split("-")[1].strip().split(" ")[1]
|
||||
month_range = cal_header.split("-")
|
||||
from_month = month_range[0].strip()
|
||||
|
||||
to_month, to_year, from_year = None, None, None
|
||||
if len(month_range) > 1:
|
||||
to_month = month_range[1].strip().split(" ")[0]
|
||||
to_year = from_year = month_range[1].strip().split(" ")[1]
|
||||
|
||||
# if main month contains a year, set it (maybe happens in december???)
|
||||
if len(from_month.split(" ")) > 1:
|
||||
from_year = from_month.split(" ")[1]
|
||||
|
||||
Reference in New Issue
Block a user