From ddd569314500e596fffc64904ffa228b2a9b703d Mon Sep 17 00:00:00 2001 From: Hyperling Date: Tue, 26 May 2026 16:54:35 -0700 Subject: [PATCH] Adjust the website downloading command. Enhance the error output. --- tasks/general/acct_mgmt/users.yml | 35 ++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index dd6fe57..3d96b23 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -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." } }