Skip to content

Commit 26b98b4

Browse files
fix: allanime scraping (#1139)
Co-authored-by: zen <71zenith@proton.me> Unusually early x.x bump due to major outage
1 parent a4c6117 commit 26b98b4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

ani-cli

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
version_number="4.3.1"
3+
version_number="4.4.0"
44

55
# UI
66

@@ -106,7 +106,7 @@ dep_ch() {
106106

107107
# extract the video links from reponse of embed urls, extract mp4 links form m3u8 lists
108108
get_links() {
109-
episode_link="$(curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" "https://allanimenews.com/apivtwo/clock.json?id=$*" -A "$agent" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\2 >\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p')"
109+
episode_link="$(curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" "https://allanimenews.com$*" -A "$agent" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\2 >\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p')"
110110
case "$episode_link" in
111111
*crunchyroll*)
112112
curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" "$episode_link" -A "$agent" | sed 's|^#.*x||g; s|,.*|p|g; /^#/d; $!N; s|\n| >|' | sort -nr
@@ -147,6 +147,8 @@ generate_link() {
147147
5) provider_init 'usercloud' '/Uv-mp4 :/p' ;; # usercloud(mp4)(single)
148148
*) provider_init 'gogoanime' '/Luf-mp4 :/p' ;; # gogoanime(m3u8)(multi)
149149
esac
150+
hexadecimal_provider_id="$(printf "%s" "$provider_id" | sed 's/\(..\)/\\x\1/g')"
151+
provider_id=$(printf "%b" "$hexadecimal_provider_id" | sed "s/\/clock/\/clock\.json/")
150152
[ -n "$provider_id" ] && get_links "$provider_id"
151153
}
152154

@@ -165,7 +167,7 @@ get_episode_url() {
165167
# get the embed urls of the selected episode
166168
episode_embed_gql="query (\$showId: String!, \$translationType: VaildTranslationTypeEnumType!, \$episodeString: String!) { episode( showId: \$showId translationType: \$translationType episodeString: \$episodeString ) { episodeString sourceUrls }}"
167169

168-
resp=$(curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" -G "https://api.${allanime_base}/allanimeapi" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"$mode\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A "$agent" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":".*clock\?id=([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p')
170+
resp=$(curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" -G "https://api.${allanime_base}/allanimeapi" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"$mode\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A "$agent" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"#([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p')
169171
# generate links into sequential files
170172
provider=1
171173
i=0

ani-cli.1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This tool scrapes the site allanime.
1313
.PD 0
1414
.P
1515
.PD
16-
\f[B]ani-cli\f[R] without options defaults to iina on macOS, flatpak mpv on Steamdeck, mpv apk on android and mpv media player everywhere else.
16+
\f[B]ani-cli\f[R] without options defaults to iina on macOS, flatpak mpv on Steamdeck, mpv apk on android, vlc on iOS and mpv media player everywhere else.
1717
.SH OPTIONS
1818
.TP
1919
\fB\-e | --episode | -r | --range\fR \fI\,<episode>\/\fR
@@ -46,8 +46,11 @@ Fetch update from github.
4646
\fB\-v | --vlc\fR
4747
Use VLC as the media player.
4848
.TP
49-
\fB\-V | --version\fR
50-
Print version number and exit.
49+
\fB\-N | --non-interactive\fR
50+
Disable the interactive menu.
51+
.TP
52+
\fB\-S | --select-nth\fR \fI\,<index>\/\fR
53+
Selects nth entry.
5154
.TP
5255
\fB\--dub\fR
5356
Play the dubbed version. Without this flag, it'll always play the subbed version.

0 commit comments

Comments
 (0)