archive.is fix - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 83de5d9679dda2f45cb46eea0a895b230ae55df0
(DIR) parent 3f1c0bcdcea48977d1d277c74eb7c3329cb08986
(HTM) Author: eidolon <?>
Date: Fri, 11 Oct 2024 09:29:40 -0400
archive.is fix
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M annna-message-common | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/annna-message-common b/annna-message-common
@@ -165,14 +165,11 @@ case "${text}" in
fi
;;
*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
- }
+ resp=$(curl -Igsm 3 -o /dev/null -w '%{response_code},%{redirect_url}\n' "https://archive.is/newest/$uri")
+ if [ "${resp%%,*}" = "302" ]; then
+ nuri="${resp##*,}"
+ nuris="archive: $nuri"
+ fi
;;
*www.reddit.com*)
nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"