aboutsummaryrefslogtreecommitdiff
path: root/src/web/lib/feed_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/lib/feed_utils.py')
-rw-r--r--src/web/lib/feed_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/web/lib/feed_utils.py b/src/web/lib/feed_utils.py
index 80800bec..9925613f 100644
--- a/src/web/lib/feed_utils.py
+++ b/src/web/lib/feed_utils.py
@@ -1,3 +1,4 @@
+import html
import urllib
import logging
import requests
@@ -17,6 +18,19 @@ def is_parsing_ok(parsed_feed):
return parsed_feed['entries'] or not parsed_feed['bozo']
+def escape_keys(*keys):
+ def wrapper(func):
+ def metawrapper(*args, **kwargs):
+ result = func(*args, **kwargs)
+ for key in keys:
+ if key in result:
+ result[key] = html.unescape(result[key])
+ return result
+ return metawrapper
+ return wrapper
+
+
+@escape_keys('title', 'description')
def construct_feed_from(url=None, fp_parsed=None, feed=None, query_site=True):
requests_kwargs = {'headers': {'User-Agent': USER_AGENT}, 'verify': False}
if url is None and fp_parsed is not None:
bgstack15