fix representation date in FeedItem
This commit is contained in:
parent
468da6b5ee
commit
f101f825a3
4
rss.py
4
rss.py
|
@ -1,5 +1,5 @@
|
||||||
from logging import Logger
|
from logging import Logger
|
||||||
|
from time import strftime
|
||||||
from feedparser import FeedParserDict, parse
|
from feedparser import FeedParserDict, parse
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class FeedItem:
|
||||||
self.title = item.get('title', '')
|
self.title = item.get('title', '')
|
||||||
self.description = item.get('summary', '')
|
self.description = item.get('summary', '')
|
||||||
if 'published' in item:
|
if 'published' in item:
|
||||||
self.date = item.published_parsed
|
self.date = strftime("%d.%m.%Y %H:%M", item.published_parsed)
|
||||||
else:
|
else:
|
||||||
self.date = None
|
self.date = None
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,8 @@ class Notifier:
|
||||||
def __format_message(self, item: FeedItem) -> str:
|
def __format_message(self, item: FeedItem) -> str:
|
||||||
return (
|
return (
|
||||||
# TODO: Return date when FeedItem starts to return formattable datetime object
|
# TODO: Return date when FeedItem starts to return formattable datetime object
|
||||||
f"<strong><a href=\"{item.url}\">{item.title}</a></strong>\n\n"
|
f"<strong><a href=\"{item.url}\">{item.title}</a></strong>\n"
|
||||||
|
f"{item.date}\n\n"
|
||||||
f"{self.__sanitize_html(item.description)}"
|
f"{self.__sanitize_html(item.description)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue