Add ytdl:// support to annna. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 49cb5498c67963b05c2f1e51f81360563036013a | |
parent e1b717f7606117c1959ec2023c1db7442e3aa66c | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
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}" |