Fix community note in API

This commit is contained in:
Dylan 2024-09-12 23:39:27 +01:00
parent e31a5f147d
commit 1d01a6c067

View File

@ -15,7 +15,10 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
communityNote=None
try:
if "birdwatch_pivot" in tweet:
communityNote=tweet["birdwatch_pivot"]["note"]["summary"]["text"]
if 'summary' in tweet["birdwatch_pivot"]["note"]:
communityNote=tweet["birdwatch_pivot"]["note"]["summary"]["text"]
elif 'subtitle' in tweet["birdwatch_pivot"] and 'text' in tweet["birdwatch_pivot"]["subtitle"]:
communityNote=tweet["birdwatch_pivot"]["subtitle"]["text"]
except:
pass
if "extended_entities" in tweetL: