Fix curi handling. Make youtube use individuous. - 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 01d96c9afbf853e71878dc9410576cbff9a4e5a0
(DIR) parent 83de680c4f3886aace0d1e803df25ce5e1413ccf
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Sun, 14 Jun 2020 18:56:56 +0200
Fix curi handling. Make youtube use individuous.
Diffstat:
M annna-start-services | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
---
(DIR) diff --git a/annna-start-services b/annna-start-services
@@ -56,6 +56,8 @@ annna_common() {
sturi=""
# Replacement URI.
nuri=""
+ # Replacement URI display string.
+ snuri=""
# html2text content.
curi=""
# Set to 0, if some URI content should be shown.
@@ -83,30 +85,31 @@ annna_common() {
case "${uri}" in
*youtube.com/*|*youtu.be/*)
nuri="https://invidio.us/${uri#https*://*/}"
+ nuris="${nuri}"
+ fetch-uri "${nuri}" > "${tmpf}"
urititle="$(curl-grabtitle "${nuri}")"
sturi="$(subtitle-paste "${uri}")"
- nuri="invidious: ${nuri}"
- nocuri=0
+ nuris="invidious: ${nuri}"
;;
*twitter.com*)
nuri="$(printf "%s\n" "${uri}" | sed 's;\(mobile\.\)\{0,1\}twitter\.com;nitter\.net;')"
+ fetch-uri "${nuri}" > "${tmpf}"
urititle="$(curl-grabtitle "${nuri}")"
suri="$(screenshot-paste "${nuri}")"
- nuri="nitter: ${nuri} "
- nocuri=0
+ nuris="nitter: ${nuris} "
;;
*en.wikipedia.org/wiki*)
if ! regeximatch "$uri" '\.(jpg,bmp,gif,png,tiff,avi,mp4,webm,mkv,pdf,ps,eps)$';
then
- nuri="$(printf 'gopherpedia: %s \n' "${uri}" | sed -e "s;.*en.wikipedia.org/wiki;gopher://gopherpedia.com/0;" -e "s;#.*$;;")"
- curi="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)"
- nocuri=0
+ nuri="$(printf '%s\n' "${uri}" | sed -e "s;.*en.wikipedia.org/wiki;gopher://gopherpedia.com/0;" -e "s;#.*$;;")"
+ nuris="$(printf 'gopherpedia: %s \n' "${nuri}")"
+ fetch-uri "${nuri}" > "${tmpf}"
fi
;;
*www.reddit.com*)
- nuri="$(printf 'old.reddit: %s \n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"
- curi="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)"
- nocuri=0
+ nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"
+ nuris="old.reddit: ${nuri} "
+ fetch-uri "${nuri}" > "${tmpf}"
if [ -n "${uri#*www.reddit.com/r/*}" ];
then
subreddit="$(printf '%s\n' "${uri}" | cut -d / -f 5)"
@@ -117,12 +120,12 @@ annna_common() {
else
guri="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?menu&${subreddit}&10"
fi
- nuri="${nuri}; gopherdit: ${guri} "
+ nuris="${nuri}; gopherdit: ${guri} "
fi
;;
*github.com/*/blob/*)
urltitle=""
- nuri="$(printf '%s' "${uri}" | sed 's/blob/raw/')"
+ nuris="$(printf '%s' "${uri}" | sed 's/blob/raw/')"
;;
*)
mimetype="$(file -b --mime-type "${tmpf}")"
@@ -145,7 +148,7 @@ annna_common() {
outputstr="${outputstr}content: ${curi} "
fi
- [ -n "${nuri}" ] && outputstr="${outputstr}; ${nuri}"
+ [ -n "${nuris}" ] && outputstr="${outputstr}; ${nuri}"
[ -n "${urititle}" ] && outputstr="${outputstr}; title: ${urititle} "
[ -n "${suri}" ] && outputstr="${outputstr}; screen: ${suri} "
[ -n "${sturi}" ] && outputstr="${outputstr}; subtitles: ${sturi} "