sci-hub handler added for academic sites

This commit is contained in:
Luke Smith 2018-07-28 10:54:46 -04:00
parent 86fae30b5a
commit abdfebe38a

View file

@ -6,11 +6,17 @@
# if a music file or pdf, it will download, # if a music file or pdf, it will download,
# otherwise it opens link in browser. # otherwise it opens link in browser.
scihub="http://sci-hub.tw/"
# List of sites that will be opened in mpv. # List of sites that will be opened in mpv.
vidsites="youtube.com vidsites="youtube.com
\|hooktube.com \|hooktube.com
\|bitchute.com \|bitchute.com
" "
# List of academic sites whose pdfs can be dled via sci-hub.
academic="springer.com"
ext="${1##*.}" ext="${1##*.}"
mpvFiles="mkv mp4 gif webm" mpvFiles="mkv mp4 gif webm"
fehFiles="png jpg jpeg jpe" fehFiles="png jpg jpeg jpe"
@ -24,6 +30,8 @@ elif echo $wgetFiles | grep -w $ext > /dev/null; then
wget "$1" >/dev/null & disown wget "$1" >/dev/null & disown
elif echo "$@" | grep "$vidsites">/dev/null; then elif echo "$@" | grep "$vidsites">/dev/null; then
setsid nohup mpv -quiet "$1" > /dev/null & disown setsid nohup mpv -quiet "$1" > /dev/null & disown
elif echo "$@" | grep "$academic">/dev/null; then
curl -sO $(curl -s "$scihub""$@" | grep location.href | grep -o http.*pdf) & disown
else else
setsid nohup $BROWSER "$1" 2>/dev/null & disown setsid nohup $BROWSER "$1" 2>/dev/null & disown
fi fi