From 0da8de862ab4602c3724d2185a33019c3cae9506 Mon Sep 17 00:00:00 2001 From: kaliko Date: Tue, 10 Nov 2020 18:00:53 +0100 Subject: [PATCH] feeds: Proper URI parsing (thanks elghinn) --- sid/feeds.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sid/feeds.py b/sid/feeds.py index dc979e5..1b31b5c 100644 --- a/sid/feeds.py +++ b/sid/feeds.py @@ -20,6 +20,7 @@ import time import traceback from urllib.error import URLError +from urllib.parse import urlparse from feedparser import parse as feed_parse @@ -177,9 +178,10 @@ class Feeds(Plugin): date = '{:%Y-%m-%d %H:%M} (utc)'.format(self.th_mon.last_check) self.reply(rcv, f'Last feeds check: {date}') return - html = ['{1}'.format(html_escape(u), - html_escape(u[7:]) - ) for u in Feeds.FEEDS] + html = ['{1}'.format( + html_escape(u), + html_escape('{1}{2}'.format(*urlparse(u))) + ) for u in Feeds.FEEDS] msg = {'mbody': 'Feeds:\n' + '\n'.join(Feeds.FEEDS), 'mhtml': 'Feeds:
' + '
'.join(html)} self.reply(rcv, msg) -- 2.39.5