Ratelimits... :-(, fixed extra download

This commit is contained in:
Alex 2020-05-15 22:19:01 +02:00
parent 58763f5bf3
commit 7c1ff29270
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 5 additions and 5 deletions

View File

@ -19,12 +19,12 @@ function getnhentai {
local types=($(print $pageinfo | jq -r '.types[]'))
local num_pages=$(print $pageinfo | jq '.pages')
local urls=()
for i in {0..$num_pages}; do
local itoc=$(($i + 1))
[[ ${types[$i]} == p ]] && local type=png || local type=jpg
urls+=("https://i.nhentai.net/galleries/$media_id/$itoc.$type")
for i in {1..$num_pages}; do
local ctoi=$(($i - 1))
[[ ${types[$ctoi]} == p ]] && local type=png || local type=jpg
urls+=("https://i.nhentai.net/galleries/$media_id/$i.$type")
done
curl -\#ZL --remote-name-all ${urls}
curl --retry 10 -\#L --remote-name-all ${urls}
for i in *; do
local sortname="$(printf "%.3i" "${i%%.*}").${i##*.}"
[ $sortname = $i ] || mv $i $sortname