summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.scripts/linkhandler8
1 files changed, 8 insertions, 0 deletions
diff --git a/.scripts/linkhandler b/.scripts/linkhandler
index 20b1bd3..94fdd83 100755
--- 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