Outils pour utilisateurs

Outils du site


bash:hentai.ms_series_archive

Ceci est une ancienne révision du document !


Hentai.ms series archive

Usage: run the script. Enter the series you want. The script does the rest.

TIP: if you provide the series name as parameter, it won't ask you.

Example:

Ask for series: ./hentaims_archive.sh

Process Angel Beats: ./hentaims_archive.sh Angel-Beats

hentaims_archive.sh
#!/bin/bash
series="$1"
if [ -z "$1" ]
then read -p "series ? " series
fi
 
########  series page URL structure #######
#
#  by default, the script checks manga froma specific series, filtering only english type.  You can check ALL manga (including non-english) by removing "&type=english" from the URL. Also you can check only colored manga by adding "&type=color".
###########################################
 
mangacount=$(wget -q --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0" -O - "http://www.hentai.ms/manga?Series=$series&type=english" | grep -o -e '[0-9]* hentai mangas from' | sed 's/[^0-9]*//g')
pages=$(($mangacount/12+1))
echo "$series has $mangacount mangas ($pages pages)"
maxpage=$(($pages*12+1))
i=12
echo "  -checking pages..."
while [ $i -lt $maxpage ]; do
	echo "  series: $series offset: $i"
	wget -q --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0" -O - "http://www.hentai.ms/manga/&Series=$series&num=$i&type=english" | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//' | grep "$series" >> 'output.txt'
	while read line; do
		wget -q --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0" -O - "$line" | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//' | grep 'download.hentai.ms' >> 'download.txt'
	done < 'output.txt'
	rm 'output.txt'
i=$((12+$i))
done
linecount=$(wc -l 'download.txt' | cut -f1 -d ' ')
echo "Done ! I've found $linecount mangas for you."
echo "================"
echo "Let's download !"
echo "================"
	mkdir -p "$series"
	count=0
	while read line; do
		wget -q --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0" --content-disposition -P "$series" "$line"
		if [ -f "$series/index.html" ]; then echo "** WARNING: did not download properly: $line"; rm "$series/index.html"; fi
		count=$(($count+1))
		echo "ok: $count / $linecount"
	done < 'download.txt'
	rm 'download.txt'
	echo "=== finished ! ==="
bash/hentai.ms_series_archive.1368098308.txt.gz · Dernière modification : 2013-05-09 11:18 de mitsu