et-mirror - Added a tool to mirror sites for offline viewing. Also added a directory for storing simple textual notes and howto articles

This commit is contained in:
Gaston Gonzalez
2024-12-29 11:16:45 -07:00
parent 4717d2b0be
commit cc688ce583
2 changed files with 70 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
# Offline Site Recommendations
This is a list of online resources that I personally store locally
for offline browsing. This list will grow over time.
Run `et-mirror.sh <start_url>` to mirror the site. For example:
```
et-mirror.sh https://choisser.com/packet/`
```
The above command will mirror the start URL https://choisser.com/packet/
along with any pages within the site that it links to.
The mirrored site will be available in your home directory under the
`offline-www` directory. You can open the files using the Min web browser.
## Packet Radio
* https://choisser.com/packet/
* https://www.cantab.net/users/john.wiseman/Documents/
* https://soundcardpacket.org/
* https://tldp.org/HOWTO/AX25-HOWTO/index.html
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
# Author : Gaston Gonzalez
# Date : 29 December 2024
# Purpose : Mirrors a website for offline browsing
ET_OFFLINE_WWW_DIR="${HOME}/offline-www"
if [ $# -ne 1 ]; then
echo "$(basename $) Usage: $0 <start-url>"
exit 1
fi
if [ ! -e ${ET_OFFLINE_WWW_DIR} ]; then
et-log "Creating offline web directory: ${ET_OFFLINE_WWW_DIR}"
mkdir -v ${ET_OFFLINE_WWW_DIR}
fi
START_URL=$1
# Validate the URL format
if ! [[ $START_URL =~ ^https?:// ]]; then
echo "Invalid URL. Provide a valid URL that starts with http:// or https://"
exit 1
fi
DOMAIN_NAME=$(echo "$START_URL" | awk -F[/:] '{print $4}')
echo "Starting website mirroring..."
wget --mirror \
--convert-links \
--adjust-extension \
--page-requisites \
--no-parent \
--directory-prefix="${ET_OFFLINE_WWW_DIR}" \
"${START_URL}"
if [ $? -eq 0 ]; then
echo "Website mirroring completed successfully."
echo "Domain: ${DOMAIN_NAME}"
echo "URL: ${START_URL}"
echo "Output Directory: ${ET_OFFLINE_WWW_DIR}"
else
echo "An error occurred while mirroring the website."
exit 1
fi