use api key to fetch image meta

This commit is contained in:
Adithya 2023-10-13 13:43:05 +05:30
parent 51ef0a6c74
commit df0eab2e22
Signed by: adtya
GPG key ID: 48FC9915FFD326D0

View file

@ -33,7 +33,7 @@ fi
notify-send -r 9897 -i information -t 1000 "Wallpapers" "Downloading..."
URL="https://wallhaven.cc/api/v1/search?${WALLHAVEN_API_KEY}${TAGS}${CATEGORIES}${PURITY}atleast=3840x2160&ratios=16x9&sorting=random"
ID="$(curl --silent "$URL" | jq -r '.data[0].id')"
IMAGE_META=$(curl --silent "https://wallhaven.cc/api/v1/w/$ID")
IMAGE_META=$(curl --silent "https://wallhaven.cc/api/v1/w/$ID?${WALLHAVEN_API_KEY}")
IMAGE_URL="$(echo "$IMAGE_META" | jq -r '.data.path')"
IMAGE_ID="$(echo "$IMAGE_META" | jq -r '.data.id')"
FILENAME="wallhaven-$IMAGE_ID"