Advertisement
metalx1000

Pirate Bay Search

Jun 25th, 2017
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #!/bin/bash
  2. clear
  3.  
  4. s="https://thepiratebay.org/search"
  5. tmp="/tmp/pb.results"
  6.  
  7. #color settings
  8. bold=`echo -en "\e[1m"`
  9. red=`echo -en "\e[31m"`
  10. default=`echo -en "\e[39m"`
  11. blue=`echo -en "\e[34m"`
  12. reverse=`echo -en "\e[7m"`
  13. normal=`echo -en "\e[0m"`
  14.  
  15. if [ ! -f "/usr/bin/aria2c" ]
  16. then
  17.   echo "aria2c does not seem to be install"
  18.   echo "I will now try and install it..."
  19.   sudo apt install aria2 ||exit 0
  20. fi
  21.  
  22. if [ "$1" == "" ]
  23. then
  24.   echo -n "${reverse}What would you like to search for:${normal} ${default}"
  25.   read q
  26. else
  27.   q="$1"
  28. fi
  29.  
  30. echo "Searching for ${bold}${red}${q}${normal}${default}..."
  31.  
  32. wget -q "$s/$q" -O-|grep '^<a href="magnet:'|while read l
  33. do
  34.   #mag="$(echo "$l"|cut -d\" -f2|cut -d\& -f1)"
  35.   mag="$(echo "$l"|cut -d\" -f2)"
  36.   title="$(echo "$l"|cut -d\= -f4|cut -d\% -f1)"
  37.   echo "$title|$mag"
  38. done > "$tmp"
  39.  
  40. cat -n $tmp|cut -d\| -f1
  41.  
  42. echo -n "${bold}${blue}Please select a number to download: ${default}${normal}"
  43. read s
  44.  
  45. echo "${blue}"
  46. echo "${default}"
  47. d="$(sed "${s}q;d" $tmp|cut -d\| -f2)"
  48.  
  49. echo "${bold}Running Command: ${red}aria2c '$d'${default}${nomral}"
  50. aria2c "$d"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement