summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-07-28 10:54:46 -0400
committerLuke Smith <luke@lukesmith.xyz>2018-07-28 10:54:46 -0400
commitabdfebe38ab1334298cc8dd22e77c2a74123aabc (patch)
treedde813285da0aee2f797ed030b098da28a4f96bb
parent86fae30b5a6d04ce6f27fc28ec72e7f604ead971 (diff)
downloadeibhear-abdfebe38ab1334298cc8dd22e77c2a74123aabc.tar.gz
eibhear-abdfebe38ab1334298cc8dd22e77c2a74123aabc.tar.zst
eibhear-abdfebe38ab1334298cc8dd22e77c2a74123aabc.zip
sci-hub handler added for academic sites
-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