Files
pad_scrapper/pad_scrapper.sh
2025-07-08 17:10:38 +02:00

25 lines
868 B
Bash
Executable File

#!/bin/bash
login=erg-admin
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)
listAllPads_array=($(curl "https://pads.erg.be/api/1.2.1/listAllPads" -H "Authorization: Bearer $token" | jq '.data.padIDs | @sh' -r | tr -d \'))
numberOfPads=${#listAllPads_array[@]}
i=1
for padID in "${listAllPads_array[@]}"
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__")
if [ -n "$no_publish" ]
then
echo "you cannot access this pad : "$padID
else
echo "do you stuff on this pad"
# do stuff
fi
done