bot: Scrape my changes better from gitea RSS.

This commit is contained in:
Cory McWilliams 2024-11-18 22:58:51 -05:00
parent fbb975625c
commit afc1524874

View File

@ -3,6 +3,7 @@
import argparse
import feedparser
import json
import re
import subprocess
import time
@ -28,7 +29,11 @@ def get_entries():
for name, url in k_feeds.items():
feed = feedparser.parse(url)
for entry in feed.entries:
results.append((time.mktime(entry.get('updated_parsed')), name, entry.link, fix_title(entry)))
if entry.summary.startswith('<a href='):
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]))
else:
results.append((time.mktime(entry.get('updated_parsed')), name, entry.link, entry.title.split('\n')[0]))
results.sort()
results.reverse()
return results