Updated to make image selections more random
This commit is contained in:
parent
693abf5cb7
commit
1fa0bdc78a
@ -53,10 +53,13 @@ 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}"
|
||||||
|
|
||||||
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}"`
|
||||||
|
|
||||||
URL_FILE="$(echo "$RESULT" | jq -r '. | .post[0].file_url')"
|
LENGTH="$(echo "$RESULT" | jq -r '. | .post | length')"
|
||||||
RATING="$(echo "$RESULT" | jq -r '. | .post[0].rating')"
|
SELECTED=`shuf -i 0-$(expr $LENGTH - 1) -n 1`
|
||||||
|
URL_FILE="$(echo "$RESULT" | jq -r '. | .post['"$SELECTED"'].file_url')"
|
||||||
|
RATING="$(echo "$RESULT" | jq -r '. | .post['"$SELECTED"'].rating')"
|
||||||
NSFW="--nsfw"
|
NSFW="--nsfw"
|
||||||
TEXT="$MSG_NSFW"
|
TEXT="$MSG_NSFW"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user