Suwayomi-Server icon indicating copy to clipboard operation
Suwayomi-Server copied to clipboard

[Feature Request] Batch download endpoint

Open AriaMoradi opened this issue 4 years ago • 2 comments

What feature should be added to Tachidesk?

Batch download endpoint to request downloading for multiple manga in a single request

Why/Project's Benefit/Existing Problem

AriaMoradi avatar Aug 26 '21 16:08 AriaMoradi

Until this gets implemented, here's a really quick BASH script that can do the job for now :)

# Variables
BASE="http://localhost:4567"; ID="26"; FROM="1"; TO="236"

# Make cURL go brrrrr
for i in $( seq $FROM $TO ); do
    curl -s "$BASE/api/v1/download/$ID/chapter/$i" \
        -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36' \
        -H 'Accept: application/json, text/plain, */*' \
        -H 'Accept-Language: en-US,en;q=0.5' \
        -H 'Accept-Encoding: gzip, deflate, br' \
        -H 'Connection: keep-alive' \
        -H "Referer: $BASE/manga/$ID" \
        -H 'Sec-Fetch-Dest: empty' \
        -H 'Sec-Fetch-Mode: cors' \
        -H 'Sec-Fetch-Site: same-origin'
    echo "[Download requested] $BASE/manga/$ID -> Chapter $i"
done

I'm just too lazy to click "Download" button for every chapter!

fast AF

AvinashReddy3108 avatar Jun 14 '22 06:06 AvinashReddy3108

Same bash script as above but with prompts and minimal error checking.

# Variables
BASE="http://localhost:4567"; 
#ID="26"; FROM="1"; TO="236"

# Prompt
echo ENTER ID for Manga
read ID 
echo ENTER Lowest Chapter Number to Download
read FROM
echo ENTER Largest Chapter Number to Download
read TO

#Error Check
################################################ 
if [ -z "$ID" ] || [ -z "$FROM" ] || [ -z "$TO" ]
then 
	echo -e "\e[1;31;1;40mError: Input cannot be blank.\e[0m"
	sleep 5
	exit 0
fi
################################################ 
if [[ $((ID)) != $ID ]] || [[ $((FROM)) != $FROM ]] || [[ $((TO)) != $TO ]]
then
	echo -e "\e[1;31;1;40mError: Input must be a number\e[0m"
	sleep 5
	exit 0 
fi
################################################

# Make cURL go brrrrr
for i in $( seq $FROM $TO ); do
    curl -s "$BASE/api/v1/download/$ID/chapter/$i" \
        -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36' \
        -H 'Accept: application/json, text/plain, */*' \
        -H 'Accept-Language: en-US,en;q=0.5' \
        -H 'Accept-Encoding: gzip, deflate, br' \
        -H 'Connection: keep-alive' \
        -H "Referer: $BASE/manga/$ID" \
        -H 'Sec-Fetch-Dest: empty' \
        -H 'Sec-Fetch-Mode: cors' \
        -H 'Sec-Fetch-Site: same-origin'
    echo "[Download requested] $BASE/manga/$ID -> Chapter $i"
done

DecodedMonkey avatar Jul 20 '22 03:07 DecodedMonkey

what is bash script how can i do it

assome1 avatar Nov 02 '22 13:11 assome1

Considering how there was no commit mentioned in this issue and the fact that I can't find the batch download button anywhere.

Is the fix supposed to be the bash script?

ShockedCoder avatar Nov 20 '22 23:11 ShockedCoder

Considering how there was no commit mentioned in this issue and the fact that I can't find the batch download button anywhere.

Is the fix supposed to be the bash script?

The initial change was in #436

The feature will be available in the next stable release soon.

AriaMoradi avatar Nov 21 '22 00:11 AriaMoradi