summaryrefslogtreecommitdiff
path: root/nocompile/bin/tpb.sh
blob: 7162b21aacb291c29d21f1a598b157f184378010 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#get magnets based on search. easy. :P
if [ "_$1" = "_" ];then
 echo usage: tpb.sh search_term [category] [limit]
 echo "categories:"
 echo "0 = any"
 echo "100 = audio"
 echo "200 = video"
 echo "300 = applications"
 echo "400 = games"
 echo "500 = porn"

else
 if [ "_$2" = "_" ];then
  cat=0
 else
  cat="$2"
 fi
 if [ "_$3" = "_" ];then
  lim=5
 else
  lim="$3"
 fi
#last number:
#0 = any
#100 = audio
#200 = video
#300 = applications
#400 = games
#500 = porn
 wget -qO- 'https://thepiratebay.se/search/'"$1"'/0/99/'"$cat" \
   | tr '"' "\n" \
   | grep ^magnet \
   | decode_html_entities \
   | head -n "$lim"
fi