fix querying anime

This commit is contained in:
ksyasuda 2021-11-06 21:18:24 -07:00
parent 44e834c3de
commit 28666ca70a

13
ani-cli
View File

@ -5,6 +5,7 @@ if [[ -z "$XDG_CONFIG_HOME" ]]; then
XDG_CONFIG_HOME="$HOME/.config" XDG_CONFIG_HOME="$HOME/.config"
fi fi
BASE_URL="https://gogoanime.cm"
CFG_DIR="$XDG_CONFIG_HOME/ani-cli" CFG_DIR="$XDG_CONFIG_HOME/ani-cli"
ROFI_CFG="meh.rasi" ROFI_CFG="meh.rasi"
@ -52,21 +53,17 @@ err() {
search_anime() { search_anime() {
# get anime name along with its id # get anime name along with its id
search=$(printf '%s' "$1" | tr ' ' '-') search=$(printf '%s' "$1" | tr ' ' '-')
titlepattern='<a href="/category/' curl -s "$BASE_URL//search.html" \
curl -s "https://gogoanime.pe//search.html" \
-G \ -G \
-d "keyword=$search" | -d "keyword=$search" |
sed -n -E ' sed -n -E 's_^[[:space:]]*<a href="/category/([^"]*)" title="([^"]*)".*_\1_p'
s_^[[:space:]]*<a href="/category/([^"]*)" title="([^"]*)".*_\1_p
'
} }
search_eps() { search_eps() {
# get available episodes for anime_id # get available episodes for anime_id
anime_id=$1 anime_id=$1
curl -s "https://gogoanime.pe/category/$anime_id" | curl -s "$BASE_URL/category/$anime_id" |
sed -n -E ' sed -n -E '
/^[[:space:]]*<a href="#" class="active" ep_start/{ /^[[:space:]]*<a href="#" class="active" ep_start/{
s/.* '\''([0-9]*)'\'' ep_end = '\''([0-9]*)'\''.*/\2/p s/.* '\''([0-9]*)'\'' ep_end = '\''([0-9]*)'\''.*/\2/p
@ -80,7 +77,7 @@ get_dpage_link() {
anime_id=$1 anime_id=$1
ep_no=$2 ep_no=$2
curl -s "https://gogoanime.pe/$anime_id-episode-$ep_no" | curl -s "$BASE_URL/$anime_id-episode-$ep_no" |
sed -n -E ' sed -n -E '
/^[[:space:]]*<li class="dowloads">/{ /^[[:space:]]*<li class="dowloads">/{
s/.*href="([^"]*)".*/\1/p s/.*href="([^"]*)".*/\1/p