commit d4c0b96a28d813c960e1ea1826667bda1114348e parent dd4174e539d79593c836d5b43d32d203df7ae0a0 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sat, 5 Jan 2019 18:45:28 +0100 Add long timeouts for curl commands Diffstat:
M | links/bin/shdl | | | 9 | +++++---- |
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/links/bin/shdl b/links/bin/shdl @@ -9,12 +9,13 @@ else prefix="torsocks" fi -shdl() { - url=$($prefix curl -s http://sci-hub.tw/"$@" | \ +shdl_fetch() { + url=$($prefix curl --connect-timeout 30 --max-time 60 --silent \ + http://sci-hub.tw/"$@" | \ grep location.href | \ grep -o \/\/.*pdf | sed 's/^/http:/') echo $url - $prefix curl -O "$url" + $prefix curl --connect-timeout 30 --max-time 60 -O "$url" } -shdl "$@" +shdl_fetch "$@"