From 2144e991b0334aac9def384e0430be20889f1b73 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 11 Jul 2024 20:42:56 +0200 Subject: checkpoint --- share/tsh/torrentgalaxy.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 share/tsh/torrentgalaxy.sh (limited to 'share/tsh/torrentgalaxy.sh') 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" +} -- cgit v1.2.3