plainweb (643B)
1 #!/usr/bin/env bash 2 3 USER_AGENT='User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.2 Chrome/83.0.4103.122 Safari/537.36' 4 5 if [ "$1" = "-f" ]; then 6 FORCE=1 7 shift 8 fi 9 10 if [ -z "$1" ]; then 11 printf "usage: plainweb <url>\n" 12 exit 1 13 fi 14 15 HURL="/tmp/$(sha256sum <<<"$1" | awk '{print $1}').txt" 16 OUT=${2:-$HURL} 17 18 if [[ $FORCE -eq 1 ]] || [[ ! -f "$HURL" ]]; then 19 printf "fetching...\n" >&2 20 #w3m -header "$USER_AGENT" -dump "$1" > "$HURL" 21 #w3m -dump "$1" | par -w$(tput cols) > "$HURL" 22 w3m -dump "$1" > "$HURL" 23 #<"$HURL" par -w$(tput cols) > "$HURL.par" 24 fi 25 26 lessr "$HURL" 27 printf "$HURL\n" >&2