Skip to content

Instantly share code, notes, and snippets.

@radjah
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radjah/19cf2ba429392b91a7b3 to your computer and use it in GitHub Desktop.
Save radjah/19cf2ba429392b91a7b3 to your computer and use it in GitHub Desktop.
thedoujin.com
#!/bin/bash
# Параметры: id_коллекции количество_страниц папка
# Выбираем качалку и создаём папку
dldr='aria2c --remote-time'
if [ ! -d $3 ]
then
echo Creating $3...
mkdir "$3"
else
dldr='wget -nc'
fi
echo Entering $3...
cd "$3"
colid=$1
pages=$2
# Получаем список файлов и приводим его в нужный для закачки вид
for ((i=1; i<=$pages; i++))
do
curl http://thedoujin.com/index.php/categories/$colid\?Pages_page=$i|pcregrep -o -e 'data-original=\"[^\"]+'|sed -e 's/data-original="//g' -e 's/thumbnails/images/g' -e 's/thumbnail_//g' >> get.thedoujin.txt
done;
# Выкачиваем
$dldr -i get.thedoujin.txt
# Переименование
basename -a `cat get.thedoujin.txt`|awk -F. 'NF {printf "%s %03d.%s\n",$0, NR, $NF}'|xargs -t -l1 mv
# Чиста мусора
rm -f *.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment