Name: Egi 2010-11-06 12:01
Any ideas on how to parse a website with bash?
#!/bin/bash
tmp="$(tempfile)"
manga_home="http://stoptazmo.com/manga-series/$1/"
chapter_list=".$1_chapterlist"
echo "reading chapter list"
wget -q -O$tmp $manga_home
grep $tmp -e mirror | sed -e "s/^[^']*'//;s/'.*//" >"$chapter_list"
total_chapters=$(wc -l "$chapter_list" | awk '{print $1}')
if [[ $total_chapters == 0 ]]; then
echo "can not read chapters of $1. aborting"
exit 1
fi
i=1
while read url; do
echo "getting $i of $total_chapters"
wget -c "$url"
i=$((i+1))
done <"$chapter_list"