metalx1000

Torrent Search And Download

Jun 22nd, 2022 (edited)
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.87 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2022  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation, either version 3 of the License, or
  9. #(at your option) any later version.
  10.  
  11. #This program is distributed in the hope that it will be useful,
  12. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. ######################################################################
  19. url="https://thepiratebay.party/search"
  20.  
  21. [[ $1 ]] && q="$*" || read -p "Enter Search Query: " q
  22.  
  23. echo "$url/$q"|sed 's/ /%20/g'
  24. page="$(wget -qO- "$url/$q"|sed 's@+@ @g;s@%@\\x@g' | xargs -0 printf "%b")"
  25. list="$(echo "$page"|grep magnet|grep -v '<meta'|sed 's/href="magnet/\nmagnet/g'|grep magnet|cut -d\" -f1|awk -F\& '{print $2 "|" $1}'|tr "+" " "|sed 's/dn=//g')"
  26. #selection="$(echo -e "$list"|cut -d\| -f1|fzf)"
  27. selection="$(echo -e "$list"|fzf)"
  28. [[ $selection ]] || exit 1
  29.  
  30. #display File Size and Seeds
  31. title="$(echo -e "$selection"|cut -d\| -f1)"
  32. echo "$title"
  33. #echo -n "$page"|grep "$title" -A2|tail -n2 |sed 's/&nbsp;/ /g'|cut -d\> -f2|cut -d\< -f1|tr "\n" " "
  34. echo -e "Size \t\t Seeds"
  35. echo -n "$page"|
  36.   grep "$title" -A2|
  37.   tail -n2|
  38.   sed 's/<td align="right">//g;s/<\/td>//g;s/&nbsp;/ /g'|
  39.   dos2unix|
  40.   sed ':a;N;$!ba;s/\n/ \t /g'
  41.  
  42. magnet="$(echo -e "$selection"|cut -d\| -f2)"
  43.  
  44. [[ $magnet ]] || exit 1
  45. echo ": $(date +%s):0;aria2c --seed-time=1 '$magnet'" >> $HOME/.zsh_history
  46. aria2c --seed-time=1 "$magnet"
  47.  
Add Comment
Please, Sign In to add comment