Cash-investigation is a french TV-show about problemes & injustices in society.
In the episode of April 2022, they revealed some dirty tricks of the company McDonald for paying as low as possible their employee
In France, depending on the number of employees you have in your company, you have obligations ( for example, from 20 employees, you have to possese at least 6% of disabled people )
The one that interest us is
From 50 employees, you have to pay a prime of share to your employees
In the documentary, they showed that a lot of MacDonal's owner splitted their franchise in different companies in order to never cross this 49 employees
for example
Owner A have :
- Macdo 1 : 20 employees
- Macdo 2 : 40 employees
- Macdo 3 : 15 employees 75/49 employees
let's regroup them in new companies
Owner A have :
- Company A :
Macdo 1
Macdo 3
35/49 employees- Company B :
Macdo
40/49 employees
To proove that they had journalist that worked during 3 months by listing all Restaurant in phrase, fetching and crossing informations ...
Here is the reason of this article, could I help it with code ?
the code you will see can't replace the work of journalists, but I do think this could be a cool tool to help speed the process.
We will need :
First thing was to look on official Macdo website, there is a map with all available restaurant.
Open the browser terminal in network tab, then click on any restaurant
we found address ,company name & x y coordinates
To fetch this API, we need the storeID. It seems that the map is built squares by squares
The more we zoom, the more we have restaurants. We will need to zoom on every squares otherwise we will miss some points. We can also see that
https:[...]4-x-x.grid.json?key=...
https:[...]5-x-x.grid.json?key=...
https:[...]6-x-x.grid.json?key=...
https:[...]x-29-x.grid.json?key=...
https:[...]x-30-x.grid.json?key=...
https:[...]x-31-x.grid.json?key=...
https:[...]x-x-22.grid.json?key=...
https:[...]x-x-23.grid.json?key=...
https:[...]x-x-24.grid.json?key=...
we will start our incrementation on the top-left of the France , and parse every grids until bottom right
With the company name, after cleaning a bit, we can see on societe.com the missing informations
with a premium account we could even see all the other companies owned by the same person
if you make a search on googlemap with the x,y you can easyly check the restaurant
"coordinates": {
"latitude": 48.215584,
"longitude": -4.051743291
},
After getting all of this informations we should be capable of making the algo to check if the owner should have pay the tax !
here is the code part, everything is on github If you are not interested in the code part, you can skip to the Conclusion
I exagerated the split on csv to explain the process
! I'm using a token that could be expired when you use the code, you can find a new one by checking the network tab mcdonalds and replace it in list_stores.go
I placed a time.sleep of 1 second to avoid too much calls ...
start the app
go run . list-stores
the output will be a csv file
store.csv
it should contain around 4000 ids
730
361
236
[...]
The app will load all ids from store.csv, and foreach, extract
go run . info-stores
the output will be another csv file
info-stores.csv
should look like this
184,LYON VILLEFRANCHE SUR SAONE,FRAMI,45.998466;4.734668,Rue Berthelot VILLEFRANCHE SUR SAONE 69400
1659,BESANCON MARCHAUX A36 ORIGINALS AREAS,HOLDING,47.326909;6.126240,Aire de Besancon Marchaux MARCHAUX 25640
456,TOUQUES,R3,49.346960;0.096800,Chemin du Roy TOUQUES 14800
[...]
For this part there is no available API. We will have to use web-scrapping to extract the informations. We use go-colly
the last output is
info-company.csv
should look like this
[...]Restauration,20 � 49 salari�s,M Olivier BURNIAUX
[...]Services,,M Laurent COYON
[...]Restauration,20 � 49 salari�s,M Bruno PIGE
Now we have the csv, you can apply the same filters on excel we saw in the documentaries, or even make the algo on golang part ! The cool part is once you have the working code, you can repeat it as much as you want . Next year we could check if Macdonald's stoped his tricks (spoiler alert: They won't)