summaryrefslogtreecommitdiff
path: root/rss.py
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2024-05-01 09:55:35 +0200
committerAndré Glüpker <git@wgmd.de>2024-05-01 09:55:35 +0200
commite57c35d5bf0ffdc3e68779377b89e076f601dfb9 (patch)
treea4cc342abdcd7766f9ae08dc2fce3c8a12491b48 /rss.py
parent0be5fb4468df0c158ec0ec5da460f7b6d67cfb71 (diff)
downloadrss-feeds-e57c35d5bf0ffdc3e68779377b89e076f601dfb9.tar.gz
rss-feeds-e57c35d5bf0ffdc3e68779377b89e076f601dfb9.tar.bz2
rss-feeds-e57c35d5bf0ffdc3e68779377b89e076f601dfb9.zip
Escape feed data
Diffstat (limited to 'rss.py')
-rwxr-xr-xrss.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rss.py b/rss.py
index 2f67723..8625c73 100755
--- a/rss.py
+++ b/rss.py
@@ -66,6 +66,11 @@ class RSSFeed:
content: List[RSSItem]
+def escape(str):
+ str = str.replace("&", "&amp;")
+ return str
+
+
def buildRSS(feed_data: RSSFeed):
"""
feed_data = {
@@ -81,7 +86,7 @@ def buildRSS(feed_data: RSSFeed):
<channel>
<title>{feed_data['title']}</title>
<link>{feed_data['url']}</link>
- <description>{feed_data['description']}</description>
+ <description>{escape(feed_data['description'])}</description>
<lastBuildDate>{_format_date(datetime.now())}</lastBuildDate>"""
for item in feed_data["content"]: