Add detection of premalink for wordpress-generated feeds.

This commit is contained in:
Hartmut Goebel
2019-03-30 22:02:48 +01:00
parent 350f2bca3f
commit 03d48992c7

View File

@ -130,8 +130,15 @@ def get_entry(entry, generator=None):
for t in tag['term'].split(): for t in tag['term'].split():
hashtags.append('#' + t) hashtags.append('#' + t)
summary = entry.get('summary', '') summary = entry.get('summary', '')
url = entry.id
if generator == "wordpress":
links = [l for l in entry.links if l.get("rel") == "alternate"]
if len(links) > 1:
links = [l for l in entry.links if l.get("type") == "text/html"]
if links:
url = links[0]["href"]
return { return {
'url': entry.id, 'url': url,
'title': BeautifulSoup(entry.title, 'html.parser').get_text(), 'title': BeautifulSoup(entry.title, 'html.parser').get_text(),
'summary': BeautifulSoup(summary, 'html.parser').get_text(), 'summary': BeautifulSoup(summary, 'html.parser').get_text(),
'hashtags': ' '.join(hashtags), 'hashtags': ' '.join(hashtags),