first commit
This commit is contained in:
23
pad_scrapper.sh
Executable file
23
pad_scrapper.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/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)
|
||||||
|
|
||||||
|
#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 \'))
|
||||||
|
# echo "array: ${listAllPads_array[@]}" # debug
|
||||||
|
# echo "length: ${#listAllPads_array[@]}" # debug
|
||||||
|
|
||||||
|
for padID in "${listAllPads_array[@]}"
|
||||||
|
do
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user