Created
September 14, 2019 12:57
MangaRock offline JPEG downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# script to download whole manga images offline | |
# sudo apt install curl webp imagemagick wget | |
# wget "https://raw.githubusercontent.com/hjmeijer/xorfile/master/xorfile.py" | |
# n=1 ; while [[ $n != 10000000 ]] ; do echo -ne '\x65' >> key ; let n++ ; done | |
# ./manga-dl.sh 'https://mangarock.com/manga/mrs-serie-100266297' | |
URL=$1 | |
name=$(curl -s -k "$URL" | cut -d '>' -f 7 | head -n 1 | cut -d '<' -f 1 | tr -d '<>:"/\|?*') | |
mkdir "$name" | |
cd "$name" | |
manga=$(echo "$URL" | cut -d '/' -f 5) | |
chapters=$(curl -s -k "https://api.mangarockhd.com/query/web401/info?oid=$manga" | grep -o "mrs-chapter-...................." | cut -d '"' -f 1) | |
c=1 | |
for chapter in $chapters | |
do | |
mkdir $c | |
cd $c | |
mris=$(curl -s -k "https://api.mangarockhd.com/query/web401/pages?oid=$chapter" | cut -d '[' -f 2 | tr -d '"{[]}' | tr ',' ' ') | |
m=1 | |
for mri in $mris | |
do | |
curl -s -k "$mri" > mri | |
echo -ne '\x52\x49\x46\x46' >> $m.riff | |
size=$(ls -l mri | cut -d ' ' -f 5) | |
let size+=7 | |
hex=$(printf %08x $size) | |
echo -ne "\x${hex:6:2}\x${hex:4:2}\x${hex:2:2}\x${hex:0:2}" >> $m.riff | |
echo -ne '\x57\x45\x42\x50\x56\x50\x38' >> $m.riff | |
python ../../xorfile.py mri ../../key >> $m.riff | |
dwebp $m.riff -o $m.png &> /dev/null | |
convert $m.png $m.jpg >/dev/null | |
rm mri $m.riff $m.png | |
let m++ | |
done | |
cd .. | |
let c++ | |
done | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment