articles now set author as source description

oppose to the source name
This commit is contained in:
Corban-Lee Jones 2024-06-13 00:00:29 +01:00
parent 327fa2b215
commit f9bf15758a

View File

@ -118,7 +118,7 @@ class Article:
# Replace HTML with Markdown, and shorten text. # Replace HTML with Markdown, and shorten text.
title = shorten(markdownify(self.title, strip=["img", "a"]), 256) title = shorten(markdownify(self.title, strip=["img", "a"]), 256)
desc = shorten(markdownify(self.description, strip=["img"]), 4096) desc = shorten(markdownify(self.description, strip=["img"]), 4096)
author = shorten(self.source.name, 256) author = shorten(self.source.description, 256)
# validate urls # validate urls
embed_url = self.url if validators.url(self.url) else None embed_url = self.url if validators.url(self.url) else None
@ -147,6 +147,7 @@ class Source:
"""Represents an RSS source.""" """Represents an RSS source."""
name: str | None name: str | None
description: str | None
url: str | None url: str | None
icon_url: str | None icon_url: str | None
feed: FeedParserDict feed: FeedParserDict
@ -168,9 +169,12 @@ class Source:
# log.debug("Creating Source from feed: %s", dumps(feed)) # log.debug("Creating Source from feed: %s", dumps(feed))
channel = feed.get("channel", {})
return cls( return cls(
name=feed.get("channel", {}).get("title"), name=channel.get("title"),
url=feed.get("channel", {}).get("link"), description=channel.get("description"),
url=channel.get("link"),
icon_url=feed.get("feed", {}).get("image", {}).get("href"), icon_url=feed.get("feed", {}).get("image", {}).get("href"),
feed=feed feed=feed
) )