diff --git a/rss b/rss index a0b37a1..3cd25ed 100755 --- a/rss +++ b/rss @@ -4,20 +4,21 @@ #parsing rss file notify-send "Parsing SubsPlease RSS... Please Wait..." -curl -s https://subsplease.org/rss/?r=720 | tr "><" ">\n<" > $HOME/.cache/rss +curl -s https://subsplease.org/rss/?r=720 | tr "<" "\n" > $HOME/.cache/rss #extracting names and providing the menu for selecting particular title name=$(sed -n -e 's/title>\(\[SubsPlease\].*\)/\1/p' .cache/rss | sed -e 's/\[SubsPlease\] //g' -e 's/(.*//g' | dmenu -l 25 -p "Search anime:") if [ -z "$name" ]; then notify-send -u critical "Err.. Query empty" -else - #changing the name into format string for pattern matching - query=$(printf "$name" | jq -rRs @uri) - - #finding the magnet link containing the exact pattern - magnet=$(sed -n -e "s/link>\(.*$query.*\).*/\1/p" .cache/rss) - - #custom script for downloading torrent using aria2c.. you can use your own bittorrent client here - st -e $HOME/repos_scripts/torrent "$magnet" & + exit fi + +#changing the name into format string for pattern matching +query=$(printf "$name" | jq -rRs @uri) + +#finding the magnet link containing the exact pattern +magnet=$(sed -n -e "s/link>\(.*$query.*\).*/\1/p" .cache/rss) + +#custom script for downloading torrent using aria2c.. you can use your own bittorrent client here +st -e $HOME/repos_scripts/torrent "$magnet" & diff --git a/tor-cli b/tor-cli index 2da6757..07f0b78 100755 --- a/tor-cli +++ b/tor-cli @@ -2,13 +2,7 @@ mkdir -p $HOME/.cache/pirokit -sleep 0.2 - -if [ -z $1 ]; then - query=$(echo "" | dmenu -p "Search Torrent: ") -else - query=$1 -fi +query=$(printf "" | dmenu -p "Search Torrent: ") baseurl="https://1337x.to" cachedir="$HOME/.cache/pirokit" @@ -23,10 +17,9 @@ grep -o '' $cachedir/tmp.html | sed 's/<[^>]*>//g' | sed 'N;s/\n/ /' > $cachedir/seedleech.bw @@ -41,8 +34,6 @@ grep -E '/torrent/' $cachedir/tmp.html | sed -E 's#.*(/torrent/.*)/">.*/#\1#' | sed 's/td>//g' > $cachedir/links.bw - - # Clearning up some data to display sed 's/\./ /g; s/\-/ /g' $cachedir/titles.bw | sed 's/[^A-Za-z0-9 ]//g' | tr -s " " > $cachedir/tmp && mv $cachedir/tmp $cachedir/titles.bw @@ -56,6 +47,11 @@ LINE=$(paste -d\ $cachedir/size.bw $cachedir/seedleech.bw $cachedir/titles.bw cut -d\- -f1 | awk '{$1=$1; print}') +if [ -z "$LINE" ]; then + notify-send -u critical "Err.. No torrent selected!!" + exit +fi + url=$(head -n $LINE $cachedir/links.bw | tail -n +$LINE) fullURL="${baseurl}${url}/"