Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [[ -z "$1" ]] ; then
- echo "usage `basename "$0" ` <manga title>"
- exit 0
- fi
- myDIR="/home/$USER/Pictures/$1"
- manga=$( echo "$1" | sed 's/^ //' | sed 's/ /-/g' )
- link="http://www.mangapanda.com/$manga"
- useragent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0"
- nbChapters=$( wget -e robots=off --user-agent "$useragent" -qO - "$link" | sed 's/</\n</g' | grep -A 3 'class="chico_manga"' | tail -1| sed 's/<[^>]*>//' | tr -dc '0-9' )
- for (( chapter=1; chapter<=$nbChapters; chapter++ )) ; do
- nbPages=$(wget -e robots=off --user-agent "$useragent" -qO - "$link/$chapter" | sed 's/</\n</g' | grep '</select> of ' | tr -dc '0-9')
- let "nbPages +=1"
- echo "downloading chapter $chapter / $nbChapters "
- for (( i=1; i < $nbPages ; i++ )) ; do
- if ! [ -f "$myDIR/$chapter/$i.png" ] ; then
- imageLink=$(wget -e robots=off --user-agent "$useragent" -qO - "$link/$chapter/$i" | sed 's/</\n</g' | grep '<img id="img" ' )
- index=$(expr index "$imageLink" 'src' )
- let "index +=4"
- imageLink=${imageLink:$index}
- imageLink=$(echo $imageLink | cut -d'"' -f 1 )
- echo -ne "\t downloading $i of $nbPages "\\r
- curl -s -S "$imageLink" --create-dirs -o "$myDIR/$chapter/$i.png"
- fi
- done
- echo -en "\e[1A" #When you want to go N lines up, use \e[<N>A.
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement