From 5e3c17e76b6a33f49d367c59b42243c34df52f18 Mon Sep 17 00:00:00 2001 From: Maxime Date: Mon, 7 Jul 2025 18:10:24 +0200 Subject: [PATCH] first commit --- pad_scrapper.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 pad_scrapper.sh diff --git a/pad_scrapper.sh b/pad_scrapper.sh new file mode 100755 index 0000000..9f97b2a --- /dev/null +++ b/pad_scrapper.sh @@ -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