Add channel title and icon to RSS feed generation

This commit is contained in:
vvzvlad
2025-02-02 03:56:42 +03:00
parent 533fc8ba31
commit 2a6470462d
2 changed files with 18 additions and 2 deletions
+8 -1
View File
@@ -129,11 +129,18 @@ async def get_rss_feed(channel: str):
# Create FeedGenerator
fg = FeedGenerator()
fg.title(channel)
channel_title = posts[0].get('channel_title', channel) if posts else channel
channel_icon = posts[0].get('channel_icon', '') if posts else ''
fg.title(channel_title)
fg.link(href=f"https://t.me/{channel}", rel='alternate')
fg.description(f'Telegram channel {channel} RSS feed')
fg.language('ru-ru')
if channel_icon:
fg.logo(f"{settings['pyrogram_bridge_url']}/media/{channel_icon}")
fg.icon(f"{settings['pyrogram_bridge_url']}/media/{channel_icon}")
# Add channel metadata
fg.id(f"{settings['pyrogram_bridge_url']}/rss/{channel}")
fg.link(href=f"{settings['pyrogram_bridge_url']}/rss/{channel}", rel='self', type='application/rss+xml')