You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
666 B

5 years ago
#!/usr/bin/env bash
if [[ "$1" = "surf-download" ]]; then
echo "Doing surf"
shift
# I am shifting so that the vaiable numbers here are the same as in surf
useragent="$1"
cookiefile="$2"
referer="$3"
url="$4"
fi
path="$HOME/Downloads/"
5 years ago
project=$(project current --path)
if [ -n "$project" ]; then
path="$project/Downloads/"
fi
mkdir -p "$path"
5 years ago
cd "$path"
echo "$useragent"
echo "$cookiefile"
echo "$referer"
echo "$url"
if command -v aria2c; then
aria2c -U "$useragent" --referer "$referer" --load-cookies $cookiefile --save-cookies $cookiefile "$url"
else
curl -k -g -L -J -O -A "$useragent" -b "$cookiefile" -c "$cookiefile" -e "$referer" "$url"
fi