Add image in description (some RSS readers do not support media enclosure)
This commit is contained in:
+8
-2
@@ -95,19 +95,25 @@ def create_rss_feed(apps_data, feed_name, feed_description, output_file):
|
||||
if description is None:
|
||||
description = ""
|
||||
|
||||
# Append screenshot image to description if available
|
||||
if 'screenshot_url' in app and app['screenshot_url']:
|
||||
screenshot_url = str(app['screenshot_url'])
|
||||
# Append image as HTML to description
|
||||
description += f'<br/><br/><img src="{screenshot_url}" alt="Screenshot" style="max-width: 100%; height: auto;" />'
|
||||
|
||||
# Create a feed entry
|
||||
fe = fg.add_entry()
|
||||
fe.id(str(app_id)) # Ensure ID is a string
|
||||
fe.title(str(app['title'])) # Ensure title is a string
|
||||
fe.link(href=f'https://repebblesearch.com/apps/{app_id}', rel='alternate')
|
||||
|
||||
# Only set description if it's not empty
|
||||
# Set description (now includes image)
|
||||
if description:
|
||||
fe.description(description)
|
||||
else:
|
||||
fe.description("No description available")
|
||||
|
||||
# Add screenshot URL as a link with rel='enclosure' (for media)
|
||||
# Add screenshot URL as a link with rel='enclosure' (for media) - backup for readers that support it
|
||||
if 'screenshot_url' in app and app['screenshot_url']:
|
||||
fe.link(href=str(app['screenshot_url']), rel='enclosure', type='image/png')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user