summaryrefslogtreecommitdiff
path: root/share/tsh/torrentgalaxy.sh
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-11 20:42:56 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-11 20:42:56 +0200
commit2144e991b0334aac9def384e0430be20889f1b73 (patch)
treee24494dad6098a40c01532dfc59f865d7afe059b /share/tsh/torrentgalaxy.sh
parent18d5762e0d89af0aff03945c691cbd16fd231ee1 (diff)
checkpoint
Diffstat (limited to 'share/tsh/torrentgalaxy.sh')
-rwxr-xr-xshare/tsh/torrentgalaxy.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/share/tsh/torrentgalaxy.sh b/share/tsh/torrentgalaxy.sh
new file mode 100755
index 0000000..9d13cc9
--- /dev/null
+++ b/share/tsh/torrentgalaxy.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+url="https://torrentgalaxy.to"
+# shellcheck disable=SC2154
+# (we expect the variables to be set)
+
+# $1: line number used to get link
+get_magnet() { sed -n "${1}p" "$links"; }
+
+get_torrents() {
+ next="/torrents.php?search=$query"
+ curl -s "$url$next" >"$html"
+
+ pup -f "$html" -p 'div.tgxtablerow > div:nth-child(11) > span > font:first-child text{}' >"$seeds"
+
+ # No results
+ [ -s "$seeds" ] || return 1
+
+ pup -f "$html" -p 'div.tgxtablerow > div:nth-child(8) > span text{}' | tr -d ' ' >"$sizes"
+ pup -f "$html" -p 'div.tgxtablerow > div:nth-child(4) > div > a attr{title}' >"$names"
+ pup -f "$html" -p 'div.tgxtablerow > div:nth-child(5) > a:nth-child(2) attr{href}' >"$links"
+
+ paste "$sizes" "$seeds" "$names" >"$results"
+}