From ee3b5af0da25dadda9c33679ea0c7e0a741592b2 Mon Sep 17 00:00:00 2001 From: Amy <58243358+aymey@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:19:33 +1000 Subject: [PATCH] query exception handling adds exception handling for query. most useful if a query presents no magnet links. --- notflix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/notflix b/notflix index 81dc32a..d51a346 100755 --- a/notflix +++ b/notflix @@ -3,4 +3,9 @@ query=$(printf '%s' "$*" | tr ' ' '+' ) movie=$(curl -s https://1337x.wtf/search/$query/1/ | grep -Eo "torrent\/[0-9]{7}\/[a-zA-Z0-9?%-]*/" | head -n 1) magnet=$(curl -s https://1337x.wtf/$movie | grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" | head -n 1) -peerflix -l -k $magnet + +if [ "$magnet" ]; then + peerflix -l -k $magnet +else + echo "query not found." +fi