From df571304ce870c39741a0ba8b0a71e42af79819b Mon Sep 17 00:00:00 2001 From: slrslr <6596726+slrslr@users.noreply.github.com> Date: Mon, 31 May 2021 16:17:01 +0000 Subject: [PATCH 1/2] Update imgboxdwl Prefix images by number so the image order is the same as in the web gallery. My code is amateur, but it seems to be working. Test: sh imgboxdl https://imgbox.com/g/sZ6kIg3f1X --- imgboxdwl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/imgboxdwl b/imgboxdwl index 1d2cb26..6092662 100755 --- a/imgboxdwl +++ b/imgboxdwl @@ -73,12 +73,20 @@ mkdir -p "${gallery_name}" && cd "${gallery_name}" printf "\\n\\nAbout to save %d images to folder %s/\\n\\n" $(number_of_images_in_the_gallery "${gallery_url}") "${gallery_name}" +i=001; for url in $(curl -s "${gallery_url}" | grep -E -o 'thumbs[0-9]+.*"' | tr -d '"'); do +if [[ ! $i -ge $(number_of_images_in_the_gallery "${gallery_url}") ]]; then + printf -v link "https://imgbox.com/%s" $(extract_name "${url}") temp=$(curl -s "${link}" | grep -E -o 'https?.*download=true') - curl -O -# ${temp%%\?*} +# curl -O -# $(seq -w "$i"|grep "$i")_"${temp%%\?*}" + curl -o $(printf "%03d\n" $i)_$(extract_name "${url}").jpg "${temp%%\?*}" + +fi + +i=$((i+1)) done printf "\\n\\n%s images were saved to folder %s/\\n\\n" $(find . -type f | wc -l) "${gallery_name}" From f7b0b54d5d3ad31a4c253d67de2fb79240552556 Mon Sep 17 00:00:00 2001 From: slrslr <6596726+slrslr@users.noreply.github.com> Date: Mon, 31 May 2021 17:33:32 +0000 Subject: [PATCH 2/2] Update imgboxdwl I do not know simple way to detect image extension, but this worked. --- imgboxdwl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imgboxdwl b/imgboxdwl index 6092662..3363e7e 100755 --- a/imgboxdwl +++ b/imgboxdwl @@ -80,9 +80,10 @@ if [[ ! $i -ge $(number_of_images_in_the_gallery "${gallery_url}") ]]; then printf -v link "https://imgbox.com/%s" $(extract_name "${url}") temp=$(curl -s "${link}" | grep -E -o 'https?.*download=true') + temp2="$(echo ${temp%%\?*})";extension="${temp2##*.}" + + curl -o $(printf "%03d\n" $i)_$(extract_name "${url}")."$extension" -O -# "${temp%%\?*}" -# curl -O -# $(seq -w "$i"|grep "$i")_"${temp%%\?*}" - curl -o $(printf "%03d\n" $i)_$(extract_name "${url}").jpg "${temp%%\?*}" fi