From b1c301dcb5289704e1f241da5ec1f3191c0f0fee Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 12 Feb 2021 12:09:16 +0000 Subject: [PATCH] Support hashtags in json feeds --- newswire.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/newswire.py b/newswire.py index 777f31c22..2ae1eb71e 100644 --- a/newswire.py +++ b/newswire.py @@ -562,6 +562,18 @@ def _jsonFeedV1ToDict(baseDir: str, domain: str, xmlStr: str, if len(description) > maxBytes: print('WARN: json feed description is too long') continue + if jsonFeedItem.get('tags'): + if not isinstance(jsonFeedItem['tags'], list): + for tagName in jsonFeedItem['tags']: + if not isinstance(tagName, str): + continue + if ' ' in tagName: + continue + if not tagName.startswith('#'): + tagName = '#' + tagName + if tagName not in description: + description += ' ' + tagName + link = jsonFeedItem['url'] if '://' not in link: continue