aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <pcmsinan@gmail.com>2023-02-19 13:55:56 +0530
committersinanmohd <pcmsinan@gmail.com>2023-03-11 19:05:05 +0530
commit8e86a2690af639f3ff1cffde3858fdcd22d7eda8 (patch)
tree9c54a863e586dfd057fab3f4f0022d97d6877e3e
parent70c3a9209aba767678286f2d4263958b3000755b (diff)
1337x, yts: fallback to proxy if handshake fails
-rwxr-xr-x1337x6
-rwxr-xr-xyts11
2 files changed, 11 insertions, 6 deletions
diff --git a/1337x b/1337x
index 755f4b3..c8916c0 100755
--- a/1337x
+++ b/1337x
@@ -1,6 +1,7 @@
#!/bin/sh
url_1337x="https://1337x.to"
+proxy_1337x="https://1337x.torrentbay.to"
die()
{
@@ -57,7 +58,7 @@ main()
out=
query=
- dep_check "dmenu" "pirowatch"
+ dep_check "dmenu" "pirowatch" "curl"
if [ "$#" -gt 0 ] && [ "$1" = "-o" ]
then
@@ -65,6 +66,9 @@ main()
shift
fi
+ curl -Is "$url_1337x" > /dev/null ||
+ url_1337x="$proxy_1337x"
+
query="$*"
: "${query:=$(printf "" | dmenu -p " ")}"
[ -z "$query" ] &&
diff --git a/yts b/yts
index 21149c8..77082ca 100755
--- a/yts
+++ b/yts
@@ -1,9 +1,7 @@
#!/bin/sh
-# official
-# url_yts="https://yts.mx"
-# proxy
-url_yts="https://yts.torrentbay.to"
+url_yts="https://yts.mx"
+proxy_yts="https://yts.torrentbay.to"
die()
{
@@ -71,7 +69,7 @@ main()
out=
query=
- dep_check "dmenu" "pirowatch"
+ dep_check "dmenu" "pirowatch" "curl"
if [ "$#" -gt 0 ] && [ "$1" = "-o" ]
then
@@ -84,6 +82,9 @@ main()
[ -z "$query" ] &&
die "please enter a query"
+ curl -Is "$url_yts" > /dev/null ||
+ url_yts="$proxy_yts"
+
fetch="$(search_yts "$query")"
dllink="$(dllink_yts "$(echo "$fetch" | dmenu -l 25 -p " ")")"