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