diff --git a/aikatsu_story b/aikatsu_story index a0a72c4..fe21794 100755 --- a/aikatsu_story +++ b/aikatsu_story @@ -6,7 +6,8 @@ Usage: $0 [-0] [-s] [-f] [-o] [--url] [--title] episode-id -0: Aikatsu! -s: Aikatsu Stars! -f: Aikatsu Friends! - -o: Aikatsu on parade! (current default) + -o: Aikatsu on parade! + -w: Aikatsu on parade! (web anime) (current default) --url: Show story url instead of story --title: Show story title instead of story @@ -14,7 +15,7 @@ EOS exit 1 } -while getopts 0sfoh-: OPT +while getopts 0sfohw-: OPT do case $OPT in -) @@ -38,6 +39,8 @@ do ;; o) ONPARADE=1 ;; + o) ONPARADE_WEB=1 + ;; h) usage_exit ;; \?) usage_exit @@ -46,9 +49,9 @@ do done shift $((OPTIND - 1)) -if [[ -z $MUJIRUSHI && -z $STARS && -z $FRIENDS && -z $ONPARADE ]]; then - # default to ONPARADE - ONPARADE=1 +if [[ -z $MUJIRUSHI && -z $STARS && -z $FRIENDS && -z $ONPARADE && -z $ONPARADE_WEB ]]; then + # default to ONPARADE_WEB + ONPARADE_WEB=1 fi @@ -60,7 +63,13 @@ fi episode_id=`printf %03d $STORY_ID` series_id=`printf %02d $(( ($STORY_ID - 1)/ 50 + 1))` -if [[ -n $ONPARADE ]]; then +if [[ -n $ONPARADE_WEB ]]; then + # episode_id is formed of 2 digits in onparade_web + episode_id=`printf %02d $STORY_ID` + url="http://www.aikatsu.net/webanime/story-${episode_id}.html" + title_pup_command='.story-main img attr{alt}' + pup_command='.story-main-frame > :nth-child(2) json{}' +elif [[ -n $ONPARADE ]]; then url="http://www.aikatsu.net/story/story-${episode_id}.html" title_pup_command='.story-main img attr{alt}' pup_command='.story-main-frame > :nth-child(2) json{}' diff --git a/test.sh b/test.sh index 2d3d8af..2bbdf75 100755 --- a/test.sh +++ b/test.sh @@ -1,7 +1,5 @@ -# id of the last episode of Aikatsu Friends! As of 2019-09-06 -FRIENDS_LAST_EP=76 -# id of the last episode of Aikatsu on Parade! As of 2019-09-06 -ONPARADE_LAST_EP=1 +# id of the last episode of Aikatsu on Parade! web As of 2020-03-28 +ONPARADE_WEB_LAST_EP=2 ex_code=0 for i in `seq 1 178` @@ -35,7 +33,7 @@ do fi done -for i in `seq 1 $ONPARADE_LAST_EP` +for i in `seq 1 25` do story=`./aikatsu_story -o $i` title=`./aikatsu_story -o --title $i` @@ -46,4 +44,15 @@ do fi done +for i in `seq 1 $ONPARADE_WEB_LAST_EP` +do + story=`./aikatsu_story -w $i` + title=`./aikatsu_story -w --title $i` + echo "Aikatsu on Parade! web$i: $title $story" + if [[ -z $title || -z $story ]];then + echo "Failed to fetch story of Aikatsu on Parade! web ep$i" 1>&2 + ex_code=1 + fi +done + exit $ex_code