bot: Give more information about new issues.

This commit is contained in:
Cory McWilliams 2024-11-23 13:50:23 -05:00
parent 3beb1d0683
commit f9ec796291

View File

@ -29,6 +29,11 @@ def get_entries():
for name, url in k_feeds.items(): for name, url in k_feeds.items():
feed = feedparser.parse(url) feed = feedparser.parse(url)
for entry in feed.entries: for entry in feed.entries:
if '/issues/' in entry.link:
m = re.match(r'^(\d+)#(.*)#$', entry.description)
if m:
results.append((time.mktime(entry.get('updated_parsed')), name, entry.link, f'new issue #{m.group(1)}: {m.group(2)}'))
continue
if entry.summary.startswith('<a href='): if entry.summary.startswith('<a href='):
for m in re.findall(r'<a href="(.*?)">.*?</a>$\s*^([^\n]+)$', entry.summary, re.S | re.M): for m in re.findall(r'<a href="(.*?)">.*?</a>$\s*^([^\n]+)$', entry.summary, re.S | re.M):
results.append((time.mktime(entry.get('updated_parsed')), name, m[0], m[1])) results.append((time.mktime(entry.get('updated_parsed')), name, m[0], m[1]))