Skip to content

Commit

Permalink
On parade web
Browse files Browse the repository at this point in the history
Fix #1
  • Loading branch information
gecko655 committed Mar 28, 2020
1 parent efd00cc commit 5638a5f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
21 changes: 15 additions & 6 deletions aikatsu_story
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ 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
EOS
exit 1
}

while getopts 0sfoh-: OPT
while getopts 0sfohw-: OPT
do
case $OPT in
-)
Expand All @@ -38,6 +39,8 @@ do
;;
o) ONPARADE=1
;;
o) ONPARADE_WEB=1
;;
h) usage_exit
;;
\?) usage_exit
Expand All @@ -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


Expand All @@ -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{}'
Expand Down
19 changes: 14 additions & 5 deletions test.sh
Original file line number Diff line number Diff line change
@@ -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`
Expand Down Expand Up @@ -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`
Expand All @@ -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

0 comments on commit 5638a5f

Please sign in to comment.