Paste archive link only if available. - 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 914e54671c8a6a9998533063588547ddfe8258e2 DIR parent 7b94f880e6f89de7de271101d86ea542855d3cff HTML Author: eidolon <?> Date: Thu, 10 Oct 2024 16:08:52 -0400 Paste archive link only if available. Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-message-common | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -164,9 +164,15 @@ case "${text}" in nuris="text only: ${nuri}" fi ;; - *wsj.com/*|*ft.com/*|*nytimes.com/*) - nuri="https://archive.is/newest/$uri" - nuris="recent archive: $nuri" + *www.wsj.com/*|*www.ft.com/*|*www.nytimes.com/*) + curl -Ism 3 -o /dev/null -w '%{response_code}\n%{redirect_url}\n' "https://archive.is/newest/$uri" | + { + read -r resp + if [ "$resp" = "302" ]; then + read -r nuri + nuris="recent archive: $nuri" + fi + } ;; *www.reddit.com*) nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"