From d46179849bf332a76984392b28687ab5c6ed2bd5 Mon Sep 17 00:00:00 2001 From: m26dvd <31007572+m26dvd@users.noreply.github.com> Date: Thu, 31 Oct 2024 02:36:48 +0000 Subject: [PATCH] fix: ForestOfDeanDistrictCouncil --- .../councils/ForestOfDeanDistrictCouncil.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/uk_bin_collection/uk_bin_collection/councils/ForestOfDeanDistrictCouncil.py b/uk_bin_collection/uk_bin_collection/councils/ForestOfDeanDistrictCouncil.py index 81813d8c45..f257204f5c 100644 --- a/uk_bin_collection/uk_bin_collection/councils/ForestOfDeanDistrictCouncil.py +++ b/uk_bin_collection/uk_bin_collection/councils/ForestOfDeanDistrictCouncil.py @@ -82,9 +82,16 @@ def parse_data(self, page: str, **kwargs) -> dict: columns = row.find_all("td") if columns: container_type = row.find("th").text.strip() - collection_day = re.sub( - r"[^a-zA-Z0-9,\s]", "", columns[0].get_text() - ).strip() + if columns[0].get_text() == "Today": + collection_day = datetime.now().strftime("%a, %d %B") + elif columns[0].get_text() == "Tomorrow": + collection_day = (datetime.now() + timedelta(days=1)).strftime( + "%a, %d %B" + ) + else: + collection_day = re.sub( + r"[^a-zA-Z0-9,\s]", "", columns[0].get_text() + ).strip() # Parse the date from the string parsed_date = datetime.strptime(collection_day, "%a, %d %B")