Introduction
Introduction Statistics Contact Development Disclaimer Help
Only expand youtube URIs on demand using #spoil. - annna - Annna the nice frien…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 25ca69b65696aa9e81a25da027abff21729c7927
parent f74d2c991befa99db57a1302a7fe54b88d3127d4
Author: Annna Robert-Houdin <[email protected]>
Date: Sat, 25 Jan 2025 09:34:08 +0100
Only expand youtube URIs on demand using #spoil.
Youtube is annoying, hates users and the expansion adds no value to the
channel atm.
Diffstat:
M annna-message-common | 63 ++++++++++++++++++++---------…
1 file changed, 41 insertions(+), 22 deletions(-)
---
diff --git a/annna-message-common b/annna-message-common
@@ -39,9 +39,15 @@ regeximatch() {
[ "$user" = "${ircuser}" ] && exit 0
+# Flag, if some expansion of some URI happened.
uriexpansion=0
+# Do not spoil at all.
nospoil=0
+# Enforce spoiling in case of hard nospoil filter.
+dospoil=0
+# Expand meme hashtag and show recommendations.
doexpand=0
+
case "${text}" in
*\#nospoil*)
nospoil=1
@@ -71,6 +77,12 @@ case "${text}" in
;;
*http*://*|*ytdl://*)
case "${text}" in
+ *"#spoil"*)
+ dospoil=1
+ ;;
+ esac
+
+ case "${text}" in
*http*://*)
uri="$(printf "%s\n" "${text}" \
| sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p…
@@ -239,33 +251,40 @@ case "${text}" in
fi
;;
*youtube.com/*|*youtu.be/*)
- if [ -z "${uri##*youtu.be/*}" ] || [ -z "${uri##*/watch?v=*}" …
+ # Youtube is so annoying and repeatedly broken;
+ # they hate users, only expand on request.
+ if [ $dospoil -eq 1 ];
then
- ytid="${uri#http*://*/watch?v=}"
- ytid="${ytid##*embed/}"
- ytid="${ytid##*shorts/}"
- ytid="${ytid##*youtu.be/}"
- ytid="${ytid%%\?*}"
- ytid="${ytid%%&*}"
- nuri="$(get-invidious-instance)/watch?v=${ytid}"
- ytt="$(printf '%s\n' "${uri}" | sed -n 's/.*[&?]t=\([^…
- if [ -n "${ytt}" ];
+ if [ -z "${uri##*youtu.be/*}" ] \
+ || [ -z "${uri##*/watch?v=*}" ] \
+ || [ -z "${uri##*/embed/*}" ] \
+ || [ -z "${uri##*/shorts/*}" ];
+ then
+ ytid="${uri#http*://*/watch?v=}"
+ ytid="${ytid##*embed/}"
+ ytid="${ytid##*shorts/}"
+ ytid="${ytid##*youtu.be/}"
+ ytid="${ytid%%\?*}"
+ ytid="${ytid%%&*}"
+ nuri="$(get-invidious-instance)/watch?v=${ytid…
+ ytt="$(printf '%s\n' "${uri}" | sed -n 's/.*[&…
+ [ -n "${ytt}" ] && nuri="${nuri}&t=${ytt}"
+ else
+ ytid=""
+ nuri="$(get-invidious-instance)/${uri#https*:/…
+ fi
+ fetch-uri "${nuri}" > "${tmpf}"
+ urititle="$(curl-grabtitle "${nuri}")"
+ nuris="invidious: ${nuri}"
+ if [ -n "${ytid}" ];
then
- nuri="${nuri}&t=${ytt}"
+ sturi="$(subtitle-paste "${uri}")"
+ nuris="${nuris} ; metadata: gophers://codemadn…
fi
+ nocuri=1
else
- ytid=""
- nuri="$(get-invidious-instance)/${uri#https*://*/}"
+ titleend=1
fi
- fetch-uri "${nuri}" > "${tmpf}"
- urititle="$(curl-grabtitle "${nuri}")"
- nuris="invidious: ${nuri}"
- if [ -n "${ytid}" ];
- then
- sturi="$(subtitle-paste "${uri}")"
- nuris="${nuris} ; metadata: gophers://codemadness.org/…
- fi
- nocuri=1
;;
*tv.brain.rip/???-???*)
nuris="$(grep 'property="og:video:secure_url' < "${tmpf}" | se…
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.