Prevent annna from appending junk to NPR text-only URL. - 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 260301fbc5c76eea9249df03a49e94305ac99a93 DIR parent 9dd09d9f57283acb4c177775dc705f1932c892a7 HTML Author: eidolon <?> Date: Mon, 11 Mar 2024 14:41:19 -0400 Prevent annna from appending junk to NPR text-only URL. A news item's ID is not consistently in the 7th '/'-delimited field. Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-message-common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -149,10 +149,10 @@ case "${text}" in | sed 's,https://lichess.org\(/[^ ]*\)$,\1,; s,^/\([^/]*\)/black$,/black/\1,; s,/white,,; s,\(.*\),https://lichess1.org/game/export/gif\1.gif,;')" ;; *www.npr.org/*) - post="$(printf '%s\n' "${uri}" | cut -d / -f 7)" + post="$(printf '%s\n' "${uri}" | sed -n 's@.*/\([0-9]\{10\}\)/.*$@\1@p')" if [ -n "${post}" ]; then - nuri="https://text.npr.org/s.php?sId=${post}" + nuri="https://text.npr.org/${post}" nuris="text only: ${nuri}" fi ;;