archive.is: Use fetch-uri and awk. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 634f56a96cf61092bb45da29b0b4e51c7150aa30 DIR parent d9db0701357bc01845ebf395c6034676b76b4e31 HTML Author: eidolon <?> Date: Fri, 18 Oct 2024 17:27:51 -0400 archive.is: Use fetch-uri and awk. Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-message-common | 12 ++---------- M modules/tor/whitelist-from-tor | 1 + 2 files changed, 3 insertions(+), 10 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -173,16 +173,8 @@ case "${text}" in fi ;; *www.wsj.com/*|*www.ft.com/*|*www.nytimes.com/*) - resp=$(unset -v PROXY; curl -A "$(http-user-agent)" -Igsm 10 -o /dev/null -w '%{response_code},%{redirect_url}\n' "https://archive.is/newest/$uri") - respcode="${resp%%,*}" - case "$respcode" in - 302) - nuri="${resp##*,}" - nuris="archive: $nuri" - ;; - *) - nuris="archive: $respcode" - esac + archvuri=$(fetch-uri -h "https://archive.is/newest/$uri" | awk 'NR == 1 && !/302/ { exit } /^location: / { print substr($2, 1, length($2)-1) }') + [ -n "$archvuri" ] && nuris="archive: $archvuri" ;; *www.reddit.com*) nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")" DIR diff --git a/modules/tor/whitelist-from-tor b/modules/tor/whitelist-from-tor @@ -1,2 +1,3 @@ www.forgottenweapons.com forgottenweapons.com +archive.is