mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
optimizations and code cleanup
This commit is contained in:
12
rss
12
rss
@@ -4,21 +4,21 @@
|
|||||||
|
|
||||||
#parsing rss file
|
#parsing rss file
|
||||||
notify-send "Parsing SubsPlease RSS... Please Wait..."
|
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=1080 | tr "<" "\n" > $HOME/.cache/rss
|
||||||
|
|
||||||
#extracting names and providing the menu for selecting particular title
|
#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:")
|
name=$(sed -n -e 's/title>\[.*Please\] \(.*\)/\1/p' .cache/rss | dmenu -l 25 -p "Search anime:")
|
||||||
|
|
||||||
if [ -z "$name" ]; then
|
if [ -z "$name" ]; then
|
||||||
notify-send -u critical "Err.. Query empty"
|
notify-send -u critical "Err.. Query empty"
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#changing the name into format string for pattern matching
|
#extracting id from anime_name_[id].mkv
|
||||||
query=$(printf "$name" | jq -rRs @uri)
|
id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p')
|
||||||
|
|
||||||
#finding the magnet link containing the exact pattern
|
#finding the magnet link containing the exact pattern
|
||||||
magnet=$(sed -n -e "s/link>\(.*$query.*\).*/\1/p" .cache/rss)
|
magnet=$(sed -n -e "s/link>\(.*$id.*\).*/\1/p" .cache/rss | sed 's/amp;//g')
|
||||||
|
|
||||||
#custom script for downloading torrent using aria2c.. you can use your own bittorrent client here
|
#custom script for downloading torrent using aria2c.. you can use your own bittorrent client here
|
||||||
st -e $HOME/repos_scripts/torrent "$magnet" &
|
st -e $HOME/repos_scripts/torrent "$magnet" &
|
||||||
|
|||||||
3
tor-cli
3
tor-cli
@@ -59,7 +59,4 @@ fullURL="${baseurl}${url}/"
|
|||||||
curl -s $fullURL -o $cachedir/tmp.html
|
curl -s $fullURL -o $cachedir/tmp.html
|
||||||
magnet=$(grep -Po "magnet.*\" " $cachedir/tmp.html | tr -d \")
|
magnet=$(grep -Po "magnet.*\" " $cachedir/tmp.html | tr -d \")
|
||||||
|
|
||||||
echo $magnet > $HOME/.cache/maglink
|
|
||||||
|
|
||||||
st -e $HOME/repos_scripts/torrent "$magnet" &
|
st -e $HOME/repos_scripts/torrent "$magnet" &
|
||||||
|
|
||||||
|
|||||||
6
torrent
6
torrent
@@ -28,11 +28,9 @@ part_tor(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
|
trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP
|
||||||
file=$HOME/.cache/maglink
|
|
||||||
xclip -out clipboard > $file
|
|
||||||
|
|
||||||
if [ -f "$file" ]; then
|
if [ -z "$*" ]; then
|
||||||
magnet=$(cat $file)
|
magnet=$(xclip -out clipboard)
|
||||||
else
|
else
|
||||||
magnet=$*
|
magnet=$*
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user