Skip to content

Commit 5c0fb1d

Browse files
committed
fix: #1554 - Folkestone and Hythe District Council
fix: #1554 - Folkestone and Hythe District Council
1 parent 37590c7 commit 5c0fb1d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

uk_bin_collection/uk_bin_collection/councils/FolkstoneandHytheDistrictCouncil.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,28 @@ def parse_data(self, page: str, **kwargs) -> dict:
7474
}
7575
bindata["bins"].append(dict_data)
7676

77+
# Extract the Garden Waste schedule
78+
garden_waste_section = soup.find(
79+
"span", text=lambda x: x and "Garden Waste" in x
80+
)
81+
if garden_waste_section:
82+
bin_types = garden_waste_section.text.replace("Garden Waste: ", "").split(
83+
" / "
84+
)
85+
garden_waste_dates = garden_waste_section.find_next("ul").find_all("li")
86+
for date in garden_waste_dates:
87+
for bin_type in bin_types:
88+
dict_data = {
89+
"type": bin_type.strip(),
90+
"collectionDate": datetime.strptime(
91+
remove_ordinal_indicator_from_date_string(
92+
date.text.strip()
93+
),
94+
"%A %d %B %Y",
95+
).strftime("%d/%m/%Y"),
96+
}
97+
bindata["bins"].append(dict_data)
98+
7799
bindata["bins"].sort(
78100
key=lambda x: datetime.strptime(x.get("collectionDate"), "%d/%m/%Y")
79101
)

0 commit comments

Comments
 (0)