Add ytdl:// support to annna. - 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 49cb5498c67963b05c2f1e51f81360563036013a DIR parent e1b717f7606117c1959ec2023c1db7442e3aa66c HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 3 Jul 2022 16:50:01 +0200 Add ytdl:// support to annna. Thanks Ivan for the hint! Diffstat: M annna-message-common | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -40,9 +40,18 @@ case "${text}" in query=${text#**::} query=${query%%::*} annna-say -s "${server}" -c "${channel}" "$(dalle-gen-emoji "${query}")" & ;; -*http*://*) - uri="$(printf "%s\n" "${text}" \ - | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')" +*http*://*|*ytdl://*) + case "${text}" in + *http*://*) + uri="$(printf "%s\n" "${text}" \ + | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')" + ;; + *ytdl://*) + ytid="$(printf "%s\n" "${text}" \ + | sed -n '/.*ytdl:\/\/\([^ ]\{1,\}\).*/s//\1/p')" + uri="$(printf "https://www.youtube.com/watch?v=%s" "${ytid}")" + ;; + esac tmpf=$(mktemp) fetch-uri "${uri}" > "${tmpf}"