use seed from initial response if available fetching a different page
This commit is contained in:
parent
ff657ed754
commit
9b756835a2
1 changed files with 5 additions and 1 deletions
|
@ -76,7 +76,11 @@ RANDOM_ITEM="$(shuf -i 0-$((NO_OF_IMAGES-1)) -n 1 --random-source=/dev/urandom)"
|
||||||
ITEM_PAGE=$((RANDOM_ITEM/24))
|
ITEM_PAGE=$((RANDOM_ITEM/24))
|
||||||
ITEM_NUMBER=$((RANDOM_ITEM%24))
|
ITEM_NUMBER=$((RANDOM_ITEM%24))
|
||||||
if [ "${ITEM_PAGE}" -gt 0 ]; then
|
if [ "${ITEM_PAGE}" -gt 0 ]; then
|
||||||
CURL_CMD="${CURL_BASE_CMD} \"${URL}page=$((ITEM_PAGE+1))\""
|
SEED="$(printf "${RESULT}" | jq -r '.meta.seed // empty')"
|
||||||
|
if [ -n "${SEED}" ]; then
|
||||||
|
SEED="seed=${SEED}&"
|
||||||
|
fi
|
||||||
|
CURL_CMD="${CURL_BASE_CMD} \"${URL}${SEED}page=$((ITEM_PAGE+1))\""
|
||||||
RESULT="$(eval ${CURL_CMD})"
|
RESULT="$(eval ${CURL_CMD})"
|
||||||
fi
|
fi
|
||||||
ID="$(printf "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].id")"
|
ID="$(printf "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].id")"
|
||||||
|
|
Loading…
Reference in a new issue