Last active
August 29, 2015 14:01
-
-
Save shinkbr/054246d9dea704fdc844 to your computer and use it in GitHub Desktop.
パンツ先生のプリキュア芸術の取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 実行したディレクトリにパンツ先生のプリキュア芸術の泉を爆誕させる | |
# http://diary.fc2.com/cgi-sys/ed.cgi/kazuharoom/ | |
usage(){ | |
echo "Usage: `basename $0` YEAR(yyyy) [MONTH(m)]" | |
exit 1 | |
} | |
get_images_month(){ | |
mkdir -p $kazuha_root/$year/$month | |
cd $kazuha_root/$year/$month | |
for day in `seq 31` | |
do | |
if curl "http://diary.fc2.com/cgi-sys/ed.cgi/kazuharoom/?Y=$year&M=$month&D=$day" | iconv -f SJIS -t UTF8 | grep "プリキュア"; then | |
curl -O "http://diary.fc2.com/user/kazuharoom/img/"$year"_$month/$day.jpg" | |
if [ $day -lt 10 ]; then | |
mv "$day".jpg 0"$day".jpg | |
fi | |
fi | |
done | |
if [ $month -lt 10 ]; then | |
mv $kazuha_root/$year/$month $kazuha_root/$year/0$month | |
fi | |
} | |
if [ $# -eq 0 -o $# -gt 2 ]; then | |
usage | |
else | |
kazuha_root=`pwd`/kazuha_precure | |
year=$1 | |
if [ $# -eq 1 ]; then | |
for month in `seq 12` | |
do | |
get_images_month | |
done | |
else | |
month=$2 | |
get_images_month | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment