Compare commits

...

3 Commits

Author SHA1 Message Date
ksyasuda
924b0eed76 update watch history when downloading anime 2022-02-20 15:36:34 -08:00
ksyasuda
74ac27bb79 update link parsing 2022-02-19 22:14:01 -08:00
ksyasuda
7c85a91d65 spaces -> tabs 2022-02-19 22:13:07 -08:00
3 changed files with 1115 additions and 1116 deletions

11
ani-cli
View File

@ -83,11 +83,10 @@ get_dpage_link() {
ep_no=$2 ep_no=$2
# credits to fork: https://github.com/Dink4n/ani-cli for the fix # credits to fork: https://github.com/Dink4n/ani-cli for the fix
anime_page=$(curl -s "$BASE_URL/$anime_id-$ep_no") for params in "-episode-$ep_no" "-$ep_no" "-episode-$ep_no-1" "-camrip-episode-$ep_no"; do
anime_page=$(curl -s "$BASE_URL/$anime_id$params")
if printf '%s' "$anime_page" | grep -q "404"; then printf '%s' "$anime_page" | grep -q '404' || break
anime_page=$(curl -s "$BASE_URL/$anime_id-episode-$ep_no") done
fi
printf '%s' "$anime_page" | printf '%s' "$anime_page" |
sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p' | sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p' |
@ -618,7 +617,7 @@ open_episode() {
fi fi
# Don't update watch history if downloading episode # Don't update watch history if downloading episode
(("$is_download" == 0)) && insert_history "watch" "$anime_id" "$episode" insert_history "watch" "$anime_id" "$episode"
lg "Getting data for episode $episode" lg "Getting data for episode $episode"
dpage_link=$(get_dpage_link "$anime_id" "$episode") dpage_link=$(get_dpage_link "$anime_id" "$episode")