betterer code

This commit is contained in:
coolnsx
2023-01-15 19:45:28 +05:30
parent 6007f6baf6
commit 48b2c30cad
4 changed files with 15 additions and 12 deletions

View File

@@ -2,5 +2,6 @@
[ -z "$*" ] && query=$(printf "" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -p "Search torrent: ") || query=$*
[ -z "$query" ] && exit 0
magnet=$(curl -s "https://thepiratebay0.org/search/$query" | tr '\n' ' ' | sed -e 's_<div_\n_g;s_</tr>_\n_g;s_&nbsp\;__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)
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_&nbsp\;__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" ] || setsid -f $TERMINAL -e $HOME/repos_scripts/torrent "$magnet"