diff --git a/.scripts/linkhandler b/.scripts/linkhandler index 8a205550..d809f7f1 100755 --- a/.scripts/linkhandler +++ b/.scripts/linkhandler @@ -28,6 +28,9 @@ imgurClientId="" # Temp file directory tmpDir="/tmp/linkhandler" +# SciHub domain +sciHub="http://sci-hub.tw" + ## Handlers # Images @@ -285,6 +288,12 @@ for arg; do printMessage "Link type: Gif" gifQueue+=( "${arg%/DASHPlaylist.mpd}/DASHPlaylist.mpd" ) + # SciHub document + elif [[ $arg =~ springer\.com/.+ ]]; then + printMessage "Link type: Download" + curl -sO "$(curl -s "$sciHub/$arg" | + grep -Po "(?<=location.href=').+.pdf")" &disown + # Gif elif echo "$arg" | grep -q "$gifSites" || echo "$gifFiles" | grep -q "${ext%%\?*}"; then