From c3d0865f4cc27e2f2da5898d2412eeb5a9a40ca0 Mon Sep 17 00:00:00 2001 From: HirschBerge Date: Fri, 18 Oct 2024 16:43:56 -0400 Subject: [PATCH] avoids reencoding the + while running time_until_next_ep the literal `+` representing spaces are encodes as %2B and they mangle the curl api call --- ani-cli | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ani-cli b/ani-cli index 5a65fe840..1f8987948 100755 --- a/ani-cli +++ b/ani-cli @@ -218,7 +218,8 @@ search_anime() { time_until_next_ep() { animeschedule="https://animeschedule.net" - curl -s -G "$animeschedule/api/v3/anime" --data-urlencode "q=$1" | sed 's|"id"|\n|g' | sed -nE 's|.*,"route":"([^"]*)","premier.*|\1|p' | while read -r anime; do + avoids_reencoding="$(printf "%s" "$1" |sed 's/+/ /g')" + curl -s -G "$animeschedule/api/v3/anime" --data-urlencode "q=$avoids_reencoding" | sed 's|"id"|\n|g' | sed -nE 's|.*,"route":"([^"]*)","premier.*|\1|p' | while read -r anime; do data=$(curl -s "$animeschedule/anime/$anime" | sed '1,/"anime-header-list-buttons-wrapper"/d' | sed -nE 's|.*countdown-time-raw" datetime="([^"]*)">.*|Next Raw Release: \1|p;s|.*countdown-time" datetime="([^"]*)">.*|Next Sub Release: \1|p;s|.*english-title">([^<]*)<.*|English Title: \1|p;s|.*main-title".*>([^<]*)<.*|Japanese Title: \1|p') status="Ongoing" color="33"