first cleaning

This commit is contained in:
Maxime
2025-07-08 17:10:38 +02:00
parent 5e3c17e76b
commit 97a3365cb2
2 changed files with 6 additions and 4 deletions

View File

@@ -1,2 +1,3 @@
# pad_scrapper # Pad Scrapper
Ce script a pour objectif de consulter les pads de l'erg dans une perspective de recherche autour de la question "comment fait-on école ?" lancée en 2025.

View File

@@ -5,13 +5,14 @@ password=$(< password-admin.txt)
token=$(curl "https://pads.erg.be/oidc/token" -X POST -H 'content-type: application/x-www-form-urlencoded' --data grant_type=client_credentials --data client_id="$login" --data client_secret="$password" -s | jq .access_token -r) token=$(curl "https://pads.erg.be/oidc/token" -X POST -H 'content-type: application/x-www-form-urlencoded' --data grant_type=client_credentials --data client_id="$login" --data client_secret="$password" -s | jq .access_token -r)
#curl "https://pads.erg.be/api/1/getText?&padID=erg-nomade " -H "Authorization: Bearer $token"
listAllPads_array=($(curl "https://pads.erg.be/api/1.2.1/listAllPads" -H "Authorization: Bearer $token" | jq '.data.padIDs | @sh' -r | tr -d \')) listAllPads_array=($(curl "https://pads.erg.be/api/1.2.1/listAllPads" -H "Authorization: Bearer $token" | jq '.data.padIDs | @sh' -r | tr -d \'))
# echo "array: ${listAllPads_array[@]}" # debug numberOfPads=${#listAllPads_array[@]}
# echo "length: ${#listAllPads_array[@]}" # debug i=1
for padID in "${listAllPads_array[@]}" for padID in "${listAllPads_array[@]}"
do do
echo $i "/" $numberOfPads
((i+=1))
no_publish=$(curl -s "https://pads.erg.be/api/1/getText?&padID=$padID" -H "Authorization: Bearer $token" | grep "__NOPUBLISH__") no_publish=$(curl -s "https://pads.erg.be/api/1/getText?&padID=$padID" -H "Authorization: Bearer $token" | grep "__NOPUBLISH__")
if [ -n "$no_publish" ] if [ -n "$no_publish" ]
then then