Last active
June 27, 2016 09:46
-
-
Save adeonhy/cd190bb815b80a65df926f552b92e7c1 to your computer and use it in GitHub Desktop.
http://www.nichibi-chinese.com/web-lesson の無料講座をダウンロード
This file contains hidden or 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/bash | |
BASE_URL='http://www.nichibi-chinese.com' | |
LIST_URL='http://www.nichibi-chinese.com/web-lesson' | |
LIST=$(curl ${LIST_URL} \ | |
| egrep '<li class=\"page_item page-item-\d*\">' \ | |
| gsed 's/.*<a href=\"\(.*\)\">\(.*\)<\/a><\/li>.*/\1,\2/' \ | |
| gsed 's/\s\+/_/g' \ | |
| grep -v '%' \ | |
| egrep -v '<|>' \ | |
| awk '{printf "%03d,%s\n", NR, $0}' \ | |
| sed 's/\&\#8230;/…/g' | |
) | |
for i in $LIST | |
do | |
IFS=',' | |
set -- $i # $1: num, $2: url, $3: title | |
# echo $1 $2 $3 | |
MOVIE_PATH=$( | |
curl $2 \ | |
| grep video |grep mp4 \ | |
| sed 's/.*src=\"\(.*mp4\)\".*/\1/' \ | |
) | |
MOVIE_URL=${BASE_URL}${MOVIE_PATH} | |
echo $MOVIE_URL | |
curl $MOVIE_URL -o ${1}_${3//\//-}.mp4 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment