Merge pull request #277 from kkiwior/main

Add replyingToID field in api response
This commit is contained in:
Dylan 2025-04-24 13:21:06 +01:00 committed by GitHub
commit 9a4889fab3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -219,6 +219,10 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
if 'in_reply_to_screen_name' in tweetL and tweetL['in_reply_to_screen_name'] != None: if 'in_reply_to_screen_name' in tweetL and tweetL['in_reply_to_screen_name'] != None:
replyingTo = tweetL['in_reply_to_screen_name'] replyingTo = tweetL['in_reply_to_screen_name']
replyingToID = None
if 'in_reply_to_status_id_str' in tweetL andTweetL['in_reply_to_status_id_str'] != None:
replyingToID = tweetL['in_reply_to_status_id_str']
apiObject = { apiObject = {
"text": twText, "text": twText,
"likes": tweetL["favorite_count"], "likes": tweetL["favorite_count"],
@ -244,6 +248,7 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
"article": tweetArticle, "article": tweetArticle,
"lang": lang, "lang": lang,
"replyingTo": replyingTo, "replyingTo": replyingTo,
"replyingToID": replyingToID,
} }
try: try:
apiObject["date_epoch"] = int(datetime.strptime(tweetL["created_at"], "%a %b %d %H:%M:%S %z %Y").timestamp()) apiObject["date_epoch"] = int(datetime.strptime(tweetL["created_at"], "%a %b %d %H:%M:%S %z %Y").timestamp())