UKBinCollectionData icon indicating copy to clipboard operation
UKBinCollectionData copied to clipboard

Add Birmingham city council

Open shmink opened this issue 1 year ago • 0 comments

Name of Council

Birmingham city council

Example Address/Postcode

B5 7XE

Additional Information

POST: URL to bin collections

Further information is that I've managed to work out a few things as I was planning on implementing my own version for myself but found this project hoping that Birmingham council might already be on here. My use case is for use on a microcontroller so this project might be too big to actually fit onto the microcontroller I was going to use but I thought it might be of use to share some information.

I've managed to replicate the request in insomnia client with the following.

Content-Type

The body seems to be a multipart. I'm not sure if all the following is needed or not.

key value
boundary ---------------------------95670993333828825821478243418
__token Hje5k3vO5Sb_kQo6zx9xiURtUWd97fAWUsLzjScWuHq
page 491
locale en_GB
q1f8ccce1d1e2f58649b4069712be6879a839233f_0_0 B5 7XE
q1f8ccce1d1e2f58649b4069712be6879a839233f_1_0 100070445256
next Next

I'm not sure if boundary changes. I would assume __token would change but I seem to have been able to use the same token now for a couple hours (that token won't work as I've changed some values before I post it online).

q1f8ccce1d1e2f58649b4069712be6879a839233f_0_0 seems to be the key for postcode ¯\_(ツ)_/¯

q1f8ccce1d1e2f58649b4069712be6879a839233f_1_0 might be some kind of index value for a house

next=Next no idea


Other headers

There's a PHPSESSID and a TestCookie. Not sure if TestCookie is actually necessary but at least it's value never changes which is TestCookie=Test. Again, no idea why it's even in the request but who knows.


Response

pastebin example response

Note: "Household collection" is a black bin that can be filled with anything and collected every friday. "Recycling collection" is a blue bin that is collected every other friday.

I haven't really thought it through at the moment but I was imagining I might take the response as a string and split on <td> or something like that. Or if I was better at regex then maybe some regex to extract the dates.

The dates are user friendly but not dev friendly with the next collection date being "Friday (12th)" for example. I was imagining having some logic where if todays day is less than that "12" then just create a new date where it's the 12 and then current month and year. If todays day is bigger than the date shown then assume it means next month so next collection date is the day shown and the month is current month + 1. Maybe this is too much information but I just thought I would throw some ideas out if it helps or if I end up creating an PR for this issue anyway.

Verification

  • [X] I searched for similar issues at https://github.com/robbrad/UKBinCollectionData/issues?q=is:issue and found no duplicates
  • [X] I have provided a tested working address/postcode/UPRN with bin collections available
  • [X] I understand that this project is run by volunteer contributors and completion depends on numerous factors - even with a request, we cannot guarantee if/when your council will get a script

shmink avatar Jan 11 '24 17:01 shmink