From f9bf15758ae5200e7f829f2ffd415708cc254ce8 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Thu, 13 Jun 2024 00:00:29 +0100 Subject: [PATCH] articles now set author as source description oppose to the source name --- src/feed.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/feed.py b/src/feed.py index 67e2117..293034f 100644 --- a/src/feed.py +++ b/src/feed.py @@ -118,7 +118,7 @@ class Article: # Replace HTML with Markdown, and shorten text. title = shorten(markdownify(self.title, strip=["img", "a"]), 256) desc = shorten(markdownify(self.description, strip=["img"]), 4096) - author = shorten(self.source.name, 256) + author = shorten(self.source.description, 256) # validate urls embed_url = self.url if validators.url(self.url) else None @@ -147,6 +147,7 @@ class Source: """Represents an RSS source.""" name: str | None + description: str | None url: str | None icon_url: str | None feed: FeedParserDict @@ -168,9 +169,12 @@ class Source: # log.debug("Creating Source from feed: %s", dumps(feed)) + channel = feed.get("channel", {}) + return cls( - name=feed.get("channel", {}).get("title"), - url=feed.get("channel", {}).get("link"), + name=channel.get("title"), + description=channel.get("description"), + url=channel.get("link"), icon_url=feed.get("feed", {}).get("image", {}).get("href"), feed=feed )