From 1d01a6c067809452276c24b9a5a6b181bf96ee59 Mon Sep 17 00:00:00 2001 From: Dylan Date: Thu, 12 Sep 2024 23:39:27 +0100 Subject: [PATCH] Fix community note in API --- vxApi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vxApi.py b/vxApi.py index b26f055..20f5163 100644 --- a/vxApi.py +++ b/vxApi.py @@ -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: