tidy it all up, bsd license
This commit is contained in:
10
nyaa
10
nyaa
@ -1,16 +1,14 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p "${XDG_CACHE_HOME:-'$HOME/.cache'}/nyaa"
|
||||
temp="${XDG_CACHE_HOME:-'$HOME/.cache'}/nyaa"
|
||||
url="https://nyaa.si"
|
||||
dir=${NYAA_DIR:-"$HOME/Downloads"}
|
||||
filter=1
|
||||
url="https://nyaa.si"
|
||||
|
||||
trap "rm -rf $temp" SIGINT SIGTERM ERR EXIT
|
||||
|
||||
while getopts axd:q: flag; do
|
||||
case "${flag}" in
|
||||
a) filter=0;;
|
||||
x) url="https://sukebei.nyaa.si";;
|
||||
d) dir=${OPTARG};;
|
||||
q) query=${OPTARG};;
|
||||
@ -25,7 +23,7 @@ if [ -z "$query" ]; then
|
||||
fi
|
||||
|
||||
query="$(echo $query | sed 's/ /+/g')"
|
||||
curl -s "$url/?s=seeders&f=$filter&q=$query" > $temp/html
|
||||
curl -s "$url/?s=seeders&q=$query" > $temp/html
|
||||
|
||||
grep -o '<a href="/view/.*</a>' $temp/html | sed 's/<[^>]*>//g' > $temp/titles
|
||||
|
||||
@ -49,7 +47,7 @@ if command -v webtorrent 2> /dev/null
|
||||
then
|
||||
webtorrent "$magnet" -o $dir
|
||||
else
|
||||
aria2c "$magnet" --seed-time 0 -d $dir
|
||||
aria2c "$magnet" -d $dir
|
||||
fi
|
||||
|
||||
echo Enjoy watching!
|
||||
|
Reference in New Issue
Block a user