Added -L flag to curl to handle redirects. Made the URL and DATA_POST variables

This commit is contained in:
Anon 2024-05-13 23:54:53 -07:00
parent 34172b09be
commit eee09b631e

View File

@ -61,9 +61,11 @@ trap "rm ${TMP}" EXIT
TAGS_FMT=`echo "$TAGS" | tr ' ' '\n' | xargs echo | tr ' ' '+'` TAGS_FMT=`echo "$TAGS" | tr ' ' '\n' | xargs echo | tr ' ' '+'`
TAGS_BLK_FMT=`xargs -a "$TAGS_BLACKLIST" echo | sed 's|\ |+-|g'` TAGS_BLK_FMT=`xargs -a "$TAGS_BLACKLIST" echo | sed 's|\ |+-|g'`
TAGS_SEARCH="${TAGS_FMT}+sort:random+-${TAGS_BLK_FMT}" 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&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 [ -z "$RESULT" ] && echo "Empty response for ${TAGS_SEARCH}" && exit 1
LENGTH="$(echo "$RESULT" | jq -r '. | .post | length')" LENGTH="$(echo "$RESULT" | jq -r '. | .post | length')"
[ "$LENGTH" = 0 ] && echo "Zero length for ${TAGS_SEARCH}" && exit 1 [ "$LENGTH" = 0 ] && echo "Zero length for ${TAGS_SEARCH}" && exit 1