mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 15:25:20 +05:30
20 lines
727 B
Bash
Executable File
20 lines
727 B
Bash
Executable File
#!/bin/sh
|
|
|
|
case $(uname -o) in
|
|
*ndroid*)
|
|
os="droid"
|
|
script_dir="$HOME"
|
|
;;
|
|
*)
|
|
os="linux"
|
|
script_dir="$HOME/repos_scripts"
|
|
;;
|
|
esac
|
|
|
|
. $script_dir/.functions
|
|
[ -z "$*" ] && search_$os "Search Torrent: " || query=$*
|
|
[ -z "$query" ] && exit 0
|
|
query=$(printf "%s" "$query" | tr ' ' '+')
|
|
magnet=$(curl -s "https://thepiratebay0.org/s/?page=0&orderby=0&q=$query" | tr '\n' ' ' | sed -e 's_<div_\n_g;s_</tr>_\n_g;s_ \;__g' | sed -nE 's_.*title.*">([^<]*).*a href="(magnet[^"]*)".*Size ([^,]*).*">([^<]*)<.*<.*_\[size:\3,se:\4\]\t\1\t\2_p' | fzf -d'\t' --with-nth ..2 | cut -f3)
|
|
[ -z "$magnet" ] || torrent_$os "$magnet"
|