commit abdfebe38ab1334298cc8dd22e77c2a74123aabc
parent 86fae30b5a6d04ce6f27fc28ec72e7f604ead971
Author: Luke Smith <luke@lukesmith.xyz>
Date: Sat, 28 Jul 2018 10:54:46 -0400
sci-hub handler added for academic sites
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/.scripts/linkhandler b/.scripts/linkhandler
@@ -6,11 +6,17 @@
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
+scihub="http://sci-hub.tw/"
+
# List of sites that will be opened in mpv.
vidsites="youtube.com
\|hooktube.com
\|bitchute.com
"
+
+# List of academic sites whose pdfs can be dled via sci-hub.
+academic="springer.com"
+
ext="${1##*.}"
mpvFiles="mkv mp4 gif webm"
fehFiles="png jpg jpeg jpe"
@@ -24,6 +30,8 @@ elif echo $wgetFiles | grep -w $ext > /dev/null; then
wget "$1" >/dev/null & disown
elif echo "$@" | grep "$vidsites">/dev/null; then
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
setsid nohup $BROWSER "$1" 2>/dev/null & disown
fi