From 18f8643725d79ed07ac32480fe3600842d431583 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 17 Oct 2020 14:59:47 +0100 Subject: [PATCH] Add hashtags for incoming news posts --- newsdaemon.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/newsdaemon.py b/newsdaemon.py index e18a9bad..61c2e913 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -378,11 +378,33 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str, httpPrefix + '://' + domain + '/@news/' + statusNumber blog['object']['published'] = dateStr + domainFull = domain + if port: + if port != 80 and port != 443: + domainFull = domain + ':' + str(port) + + hashtags = item[6] + for tagName in hashtags: + htId = tagName.replace('#', '') + hashtagUrl = \ + httpPrefix + "://" + domainFull + "/tags/" + htId + blog['object']['tag'][htId] = { + 'href': hashtagUrl, + 'name': tagName, + 'type': 'Hashtag' + } + if tagName in blog['object']['content']: + hashtagHtml = \ + "#" + \ + htId + "" + blog['object']['content'].replace(tagName, hashtagHtml) + postId = newPostId.replace('/', '#') moderated = item[5] - hashtags = item[6] savePost = newswireHashtagProcessing(session, baseDir, blog, hashtags, httpPrefix, domain, port, personCache, cachedWebfingers,