#!/bin/sh
# Donga Manhwa V 0.1 by Yang
count=1
FILE=result.tmp
URL1="http://www.donga.com/cartoon/dot/index.php?gubun="
URL2="http://www.donga.com/cartoon/dot/images/"
temp[0]=$(lynx -source $URL1"0102&page=1" | grep "<td><font size='2'>" | sed -e 's/<[^>]+>//g' -e 's////g')
temp[1]=$(lynx -source $URL1"0102&page=2" | grep "<td><font size='2'>" | sed -e 's/<[^>]+>//g' -e 's////g')
temp[2]=$(lynx -source $URL1"0102&page=3" | grep "<td><font size='2'>" | sed -e 's/<[^>]+>//g' -e 's////g')
for i in ${temp[@]}
do echo $i >> ${FILE}
done
end_date=`tail -1 ${FILE}`
until [ "$search_date" -eq "$end_date" ]
do
search_date=`head -$count ${FILE} | tail -1`
let "count +=1"
wget $URL2"0102/"$search_date"_0.jpg"
done
rm ${FILE}
mkdir -p mkdir manhwa/kkobul | mv *.jpg ./manhwa/kkobul
exit 0