Created
April 10, 2022 21:08
-
-
Save GuillaumeDesforges/3bcc98ae1a70d918cdd2e486d4e099c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s 'https://graphics.afpforum.com/data/presidential-fr-2022-live-constantes/communes_codes.json' | jq -c '.[]' \ | |
| while read commune_dict | |
do | |
code=$(echo "$commune_dict" | jq -r '.c') | |
nom=$(echo "$commune_dict" | jq -r '.n') | |
curl -sq "https://graphics.afpforum.com/data/presidential-fr-2022-live-results/resultats1/communes/IR1_$code.json" \ | |
| jq --arg code "$code" -c '.lesResultats | map({key: .individuNom, value: .resPourCent}) | from_entries | . + {code: $code}' \ | |
>> "resultats.json" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment