- Date: July 14, 2023
- Categories: Fun
The Problem
McDonalds are always out of McFlurry’s! Now it sounds funny, but it’s a genuine problem that every McDonalds branch across the globe struggles with.
McDonalds has a contract with an ice cream machine manufacturer (Taylor), where they are legally bound to purchasing Taylor ice cream machines, specifically the Taylor C602 model of ice cream machines, in this contract, they are also legally required to ONLY use Taylor certified technicians when these machines break – a kick in the teeth for right to repair, but lets not get in to that.
In and of itself, a contract described above would only cause issues if machines regularly broke. Well, that’s exactly what happens! The Taylor C602 requires a 4 hour cleaning cycle every night, and often times, ambiguous error messages pop up, requiring McDonalds to call in a Taylor certified technician to diagnose and resolve the problem.
Anyway, unfair contracts are McDonalds problem. I just want to know where I can drive to get my ice-cream, and where I can drive to get it NOW!
The Solution
Now, this project was inspired by mcbroken.com but I will be the first to admit, I am not as smart as its maker. McBroken works by misusing the official McDonalds API that powers its smartphone apps (the maker reverse engineered the android version of the McDonalds app).
Unfortunately this site only works for US McDonalds branches, so I needed to get creative. How about the UberEats API?
Step One
Explore how Uber Eats gets it’s information on what products are available. To find this out, I simply went to the Uber Eats website and selected a random McDonalds branch in Liverpool (where I was at the time), for this case McDonald’s Kensington.
In Chrome developer tools, I loaded up the Network monitor and filtered by Fetch/XHR requests. I found a request that seemed to return all information for a particular store, specifically:
- POST https://www.ubereats.com/api/getStoreV1?localeCode=gb with a body consisting of two parameters (storeUuid and sfNuggetCount)
Now I have no idea what sfNuggetCount is, but I now have a way to obtain a stores unique identifier, and retrieve it’s information, including products.
Step Two
Analyse the response. I copied the response from the above request in to a JSON pretifier. The request is rammed full of data, but I found that navigating to data -> sectionEntitiesMap there are a bunch of sections (used to separate categories of food), and if you loop through these sections and the items in them, you will eventually find McFlurry products.
Step Three
Process the data. I made a Python Program that loops through a list of curated store Uuids, and sends requests to the endpoint identified above. This program then loops through all of the products, until it finds a product with a title containing the word ‘McFlurry’. Each product object returned from the Uber Eats API has a field ‘suspendUntil’, now if this field is set to 0, the product is available, however if it is set to a date in the future, the product is not available.
The program then stores the results from all the API calls for each separate McDoanalds I have specified, and then uploads this data to a .json file via FTP to a webserver.
Step Four
Display the data. Now I am no UI designer, or front ender for that matter (apart from the few tasks my placement supervisor occasionally made me do, AngularJS gives me the chills to this day). With this in mind, I found a simple HTML template online, and displayed the data from the JSON file specified above.
The End Product