Created
November 28, 2022 15:33
-
-
Save ThomasG77/eef91d4d6125b4df1cff10a83f068386 to your computer and use it in GitHub Desktop.
Get datasets/ressources from demo.data.gouv.fr
This file contains 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
counter=0 | |
while : ; do | |
counter=$((counter+1)) | |
curl -s -X GET "https://demo.data.gouv.fr/api/1/datasets/?page=${counter}&page_size=500" >| "page_${counter}.json" | |
if [[ $( cat "page_${counter}.json" \ | |
| jq '.next_page') == 'null' ]] ; then | |
break #Exit the loop | |
fi | |
done | |
jq -c -r .data[].resources[] page_*.json >| compiled_ressources.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment