From eee09b631e79aca5eeb44acac8df229c1c95cb05 Mon Sep 17 00:00:00 2001 From: Anon Date: Mon, 13 May 2024 23:54:53 -0700 Subject: [PATCH] Added -L flag to curl to handle redirects. Made the URL and DATA_POST variables --- boorubot_v2.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/boorubot_v2.sh b/boorubot_v2.sh index f549c86..b38cf4e 100755 --- a/boorubot_v2.sh +++ b/boorubot_v2.sh @@ -61,9 +61,11 @@ trap "rm ${TMP}" EXIT TAGS_FMT=`echo "$TAGS" | tr ' ' '\n' | xargs echo | tr ' ' '+'` TAGS_BLK_FMT=`xargs -a "$TAGS_BLACKLIST" echo | sed 's|\ |+-|g'` TAGS_SEARCH="${TAGS_FMT}+sort:random+-${TAGS_BLK_FMT}" +URL="https://${BOORU_URL}/index.php" +DATA_POST="page=dapi&s=post&q=index&json=1&tags=${TAGS_SEARCH}" # RESULT=`curl -s --get "https://${BOORU_URL}/index.php" -d "page=dapi&s=post&q=index&json=1&limit=1&tags=${TAGS_SEARCH}"` -RESULT=`curl -s --get "https://${BOORU_URL}/index.php" -d "page=dapi&s=post&q=index&json=1&tags=${TAGS_SEARCH}"` +RESULT=`curl -L -s --get "${URL}" -d "${DATA_POST}"` [ -z "$RESULT" ] && echo "Empty response for ${TAGS_SEARCH}" && exit 1 LENGTH="$(echo "$RESULT" | jq -r '. | .post | length')" [ "$LENGTH" = 0 ] && echo "Zero length for ${TAGS_SEARCH}" && exit 1