Update armaghbanbridgecraigavon_gov_uk.py #4891
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an open bug [Bug]: Armagh, Babridge & Craigavon Council no longer working #4776 for this council area. I've edited the code to fix it
Changes Made:
Added Request Headers (Line 52-54):
Added User-Agent to make requests appear like a normal browser
Updated HTML Parsing (Lines 60-106):
Changed from soup.select("div.heading > h2 > i.fa") to soup.find_all("h2")
Added filtering for headings containing "Collections"
Updated parent/sibling navigation to match new structure
Used flexible class matching with lambda functions for better compatibility
Improved Date Extraction (Lines 94-105):
Added regex pattern matching to extract dates from text with icons
Added error handling for invalid date formats