From de15578d17fff52e9fae54fcea9ccee74e3e3a93 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Oct 2019 19:05:24 +0100 Subject: [PATCH] Detection of emoji --- content.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content.py b/content.py index 15b53105..3c58ca3f 100644 --- a/content.py +++ b/content.py @@ -308,8 +308,10 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \ if addHashTags(wordStr,httpPrefix,originalDomain,replaceHashTags,hashtags): continue if len(wordStr)>2: - if wordStr.startswith(':'): - if wordStr.endswith(':'): + if ':' in wordStr: + wordStr2=wordStr.split(':')[1] + if ':' in wordStr2: + wordStr2=wordStr2.split(':')[0] if not emojiDict: print('Loading emoji lookup') if not os.path.isfile(baseDir+'/emoji/emoji.json'): @@ -327,7 +329,7 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \ time.sleep(1) emojiDictCtr+=1 - addEmoji(baseDir,wordStr,httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict) + addEmoji(baseDir,':'+wordStr2+':',httpPrefix,originalDomain,replaceEmoji,hashtags,emojiDict) # replace words with their html versions for wordStr,replaceStr in replaceMentions.items():