Append timestamp from youtube-URLs to the yewtu.be-URL. - 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 2d74b67e4c0598adaddda0d2007073209610ce6d
(DIR) parent a17d8c98291940275e88fa872143baaddcf951ba
(HTM) Author: Julian Schweinsberg <pazz0@0xfa.de>
Date: Sat, 5 Aug 2023 16:29:20 +0200
Append timestamp from youtube-URLs to the yewtu.be-URL.
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M annna-message-common | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/annna-message-common b/annna-message-common
@@ -184,6 +184,11 @@ case "${text}" in
ytid="${ytid%%\?*}"
ytid="${ytid%%&*}"
nuri="https://yewtu.be/watch?v=${ytid}"
+ ytt="$(printf '%s\n' "${uri}" | sed -n 's/.*[&?]t=\([^&]\{1,\}\).*/\1/p')"
+ if [ -n "${ytt}" ];
+ then
+ nuri="${nuri}&t=${ytt}"
+ fi
else
ytid=""
nuri="https://yewtu.be/${uri#https*://*/}"