Skip to content

Commit

Permalink
fix: Glasgow City Council
Browse files Browse the repository at this point in the history
  • Loading branch information
m26dvd committed Nov 28, 2024
1 parent 7e40106 commit 706547e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions uk_bin_collection/uk_bin_collection/councils/GlasgowCityCouncil.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ def parse_data(self, page: str, **kwargs) -> dict:
"../Images/Bins/ashBin.gif": "Ash bin",
}

fieldset = soup.find("fieldset")
ps = fieldset.find_all("p")
for p in ps:
collection = p.text.strip().replace("Your next ", "").split(".")[0]
bin_type = collection.split(" day is")[0]
collection_date = datetime.strptime(
remove_ordinal_indicator_from_date_string(collection).split("day is ")[
1
],
"%A %d %B %Y",
)
dict_data = {
"type": bin_type,
"collectionDate": collection_date.strftime(date_format),
}
data["bins"].append(dict_data)

# Find the page body with all the calendars
body = soup.find("div", {"id": "Application_ctl00"})
calendars = body.find_all_next("table", {"title": "Calendar"})
Expand Down

0 comments on commit 706547e

Please sign in to comment.