summaryrefslogtreecommitdiff
path: root/share/tsh/rarbg.sh
blob: abb58c8026eb65ba582c59fa9e777493355d21dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

url="https://www2.rarbggo.to"

# $1: line number to get link
get_magnet() { curl -s "$url/$(sed -n "${1}p" "$links")" | pup -p '#hvicwlo attr{href}'; }

get_torrents() {
	>&2 printf "$url/search/?search=$query"
	curl -s "$url/search/?search=$query" >"$html"

	row='table.tablelist2 > tbody > tr.table2ta > td.tlista'
	pup -p "$row:nth-child(2) > a text{}" <"$html" >"$names"
	pup -p "$row:nth-child(5) text{}" <"$html" | tr -d ' ' >"$sizes"
	pup -p "$row:nth-child(6) > font text{}" <"$html" >"$seeds"
	pup -p "$row:nth-child(2) > a attr{href}" <"$html" >"$links"
	paste "$sizes" "$seeds" "$names" >"$results"
}