Add detection of premalink for wordpress-generated feeds.
This commit is contained in:
@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user