forked from cory/tildefriends
bot: Scrape my changes better from gitea RSS.
This commit is contained in:
parent
fbb975625c
commit
afc1524874
@ -3,6 +3,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import feedparser
|
import feedparser
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -28,7 +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:
|
||||||
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.sort()
|
||||||
results.reverse()
|
results.reverse()
|
||||||
return results
|
return results
|
||||||
|
Loading…
Reference in New Issue
Block a user