From: kaliko Date: Tue, 10 Nov 2020 17:00:53 +0000 (+0100) Subject: feeds: Proper URI parsing (thanks elghinn) X-Git-Tag: 0.3.0~23 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=0da8de862ab4602c3724d2185a33019c3cae9506;p=sid.git feeds: Proper URI parsing (thanks elghinn) --- 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)