Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created November 28, 2022 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/eef91d4d6125b4df1cff10a83f068386 to your computer and use it in GitHub Desktop.
Save ThomasG77/eef91d4d6125b4df1cff10a83f068386 to your computer and use it in GitHub Desktop.
Get datasets/ressources from demo.data.gouv.fr
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