Adjust the website downloading command. Enhance the error output.
This commit is contained in:
@@ -1109,8 +1109,6 @@
|
||||
sh -c "rm '{{ notify_log_file_wip }}'"
|
||||
fi
|
||||
function_download_website: |
|
||||
# Credit to this website or providing the base command.
|
||||
# "https://simpleit.rocks/linux/how-to-download-a-website-with-wget-the-right-way/"
|
||||
function download-website {
|
||||
website="$1"
|
||||
if [[ -z "$website" ]]; then
|
||||
@@ -1120,9 +1118,34 @@
|
||||
if [[ "$website" != "http"* ]]; then
|
||||
website="http://$website"
|
||||
fi
|
||||
wget --wait=2 \
|
||||
# https://simpleit.rocks/linux/how-to-download-a-website-with-wget-the-right-way/
|
||||
# Does not simplify the links for offline usage.
|
||||
# wget --wait=2 \
|
||||
# --level=inf \
|
||||
# --limit-rate=20K \
|
||||
# --recursive \
|
||||
# --page-requisites \
|
||||
# --user-agent=Mozilla \
|
||||
# --no-parent \
|
||||
# --convert-links \
|
||||
# --adjust-extension \
|
||||
# --no-clobber \
|
||||
# -e robots=off \
|
||||
# $website &&
|
||||
|
||||
# https://www.digitalcitizen.life/how-to-download-entire-website-for-offline-viewing/
|
||||
# This one is supposed to work too and is much smaller.
|
||||
# wget --mirror \
|
||||
# --convert-links \
|
||||
# --adjust-extension \
|
||||
# --page-requisites \
|
||||
# --no-parent \
|
||||
# $website &&
|
||||
|
||||
# Combine the two by using mirow and removing the rate limit.
|
||||
wget --mirror \
|
||||
--wait=2 \
|
||||
--level=inf \
|
||||
--limit-rate=20K \
|
||||
--recursive \
|
||||
--page-requisites \
|
||||
--user-agent=Mozilla \
|
||||
@@ -1135,7 +1158,9 @@
|
||||
{
|
||||
echo "Success!" ||
|
||||
{
|
||||
echo "ERROR: Command reported a failure. Please try again."
|
||||
echo "ERROR: Command reported a failure. (Error code '$?')"
|
||||
echo "This may mean that the URL was not converted to local links."
|
||||
echo "Please check the error and contents and try again if needed."
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user