mirror of
https://github.com/maubot/rss.git
synced 2024-10-01 08:25:36 -04:00
Hash entry content if id is missing
This commit is contained in:
parent
4e3b9ef416
commit
eed44fcafc
15
rss/bot.py
15
rss/bot.py
@ -20,6 +20,7 @@ from string import Template
|
||||
import asyncio
|
||||
|
||||
import aiohttp
|
||||
import hashlib
|
||||
import feedparser
|
||||
|
||||
from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper
|
||||
@ -147,7 +148,19 @@ class RSSBot(Plugin):
|
||||
def find_entries(cls, feed_id: int, entries: List[Any]) -> List[Entry]:
|
||||
return [Entry(
|
||||
feed_id=feed_id,
|
||||
id=entry.id,
|
||||
id=getattr(
|
||||
entry,
|
||||
"id",
|
||||
hashlib.sha1(
|
||||
" ".join(
|
||||
[
|
||||
getattr(entry, "title", ""),
|
||||
getattr(entry, "description", ""),
|
||||
getattr(entry, "link", ""),
|
||||
]
|
||||
).encode("utf-8")
|
||||
).hexdigest(),
|
||||
),
|
||||
date=cls.get_date(entry),
|
||||
title=getattr(entry, "title", ""),
|
||||
summary=getattr(entry, "description", ""),
|
||||
|
Loading…
Reference in New Issue
Block a user