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.
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
)