Radjah

mangadl.sh

Jun 27th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.02 KB | None | 0 0
  1. #! /bin/bash
  2. if [ ! -d "$1" ]
  3. then
  4. echo Creating "$1"
  5. mkdir "$1"
  6. fi
  7. # получаем список всех глав
  8. manga=$1
  9. exp1=\\/fairytail\\/\\d{1,8}\\/
  10. curl -s http://manga24.ru/$manga/ | pcregrep -o -e $exp1 > chaplist.txt
  11. echo `cat chaplist.txt|wc -l` chapters to download.
  12.  
  13. # качаем главы
  14. for i in `cat chaplist.txt| sed -s 's/\///'`;
  15. do
  16.     # папка для новой лавы
  17.     if [ ! -d "$i" ]
  18.     then
  19.         echo Creating $i...
  20.         mkdir $i
  21.     fi
  22.     echo Entering $i...
  23.     cd $i
  24.     # Временный файл
  25.     curl -s http://manga24.ru/$i/ > temp.html
  26.     # базовый url страниц
  27.     dir=`cat temp.html |pcregrep -o -e 'dir\:.+'|pcregrep -o -e 'http.*[^\(",)]'`
  28.     # Список страниц главы
  29.     expr=s/\"/$dir/g
  30.     cat temp.html | pcregrep -o -e 'images\:.+'|pcregrep -o -e '\"[^(\",)]+'| sed ${expr} > images.txt
  31.     # Всё качаем
  32.     wget -nc -i images.txt
  33.     # уборка
  34.     rm -f images.txt temp.html
  35.     # новая глава
  36.     cd ../..
  37. done;
  38.  
  39. # уборка
  40. rm -f chaplist.txt
Advertisement
Add Comment
Please, Sign In to add comment