69 lines
1.4 KiB
Bash
Executable file
69 lines
1.4 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
usage() {
|
|
printf "Usage: %s [url] [filters] [-h|--help|--wget|--httrack]\n\n" "$0"
|
|
|
|
printf " --wget Select GNU Wget\n"
|
|
printf " --httrack Select httrack to vacuum\n"
|
|
printf " -h,--help Show this help\n\n"
|
|
|
|
printf "Filters only work with httrack. \`man httrack\` to get help.\n"
|
|
}
|
|
|
|
TOOL=
|
|
URL=
|
|
|
|
for i in "$@"; do
|
|
if [ "$i" = "-h" ] || [ "$i" = "--help" ]; then
|
|
usage
|
|
exit 0
|
|
elif [ "$i" != "--httrack" ] && [ "$i" != "--wget" ]; then
|
|
URL="$URL $i"
|
|
elif [ "$i" = "--httrack" ]; then
|
|
TOOL=httrack
|
|
elif [ "$i" = "--wget" ]; then
|
|
TOOL=wget
|
|
fi
|
|
done
|
|
|
|
if [ -z "$URL" ]; then
|
|
printf "Example: https://www.example.com +assets.example.com/*\n\n"
|
|
|
|
while test -z "$URL"; do
|
|
printf "URL: "
|
|
read URL
|
|
done
|
|
fi
|
|
|
|
if [ -z "$TOOL" ]; then
|
|
while test -z "$TOOL"; do
|
|
printf ""
|
|
|
|
printf "Vacuum:\n"
|
|
printf " [1] httrack\n"
|
|
printf " [2] wget\n"
|
|
printf "> [1] "
|
|
read TOOL
|
|
|
|
if [ -z "$TOOL" ]; then
|
|
TOOL=1
|
|
fi
|
|
|
|
if [ "$TOOL" = "1" ] || [ "$TOOL" = "httrack" ]; then
|
|
TOOL=httrack
|
|
elif [ "$TOOL" = "2" ] || [ "$TOOL" = "wget" ]; then
|
|
TOOL=wget
|
|
else
|
|
TOOL=
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [ "$TOOL" = "httrack" ]; then
|
|
printf "\nCommand:\n\n httrack %s\n\n" "$URL"
|
|
httrack $URL
|
|
elif [ "$TOOL" = "wget" ]; then
|
|
printf "\nCommand:\n\n wget --progress=bar -E -r -k -np --no-check-certificate --user-agent=Firefox \"%s\"\n\n" "$URL"
|
|
wget --progress=bar -E -r -k -np --no-check-certificate --user-agent=Firefox $URL
|
|
fi
|