Add support for tweet lang parameter in API
This commit is contained in:
parent
8e17044ecd
commit
66c2996ecd
5
vxApi.py
5
vxApi.py
@ -15,6 +15,7 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
|
|||||||
communityNote=None
|
communityNote=None
|
||||||
oldTweetVersion = False
|
oldTweetVersion = False
|
||||||
tweetArticle=None
|
tweetArticle=None
|
||||||
|
lang=None
|
||||||
#editedTweet=False
|
#editedTweet=False
|
||||||
try:
|
try:
|
||||||
if "birdwatch_pivot" in tweet:
|
if "birdwatch_pivot" in tweet:
|
||||||
@ -191,6 +192,9 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
|
|||||||
for i in pollData["options"]:
|
for i in pollData["options"]:
|
||||||
i["percent"] = round((i["votes"]/totalVotes)*100,2)
|
i["percent"] = round((i["votes"]/totalVotes)*100,2)
|
||||||
|
|
||||||
|
if 'lang' in tweetL:
|
||||||
|
lang = tweetL['lang']
|
||||||
|
|
||||||
|
|
||||||
apiObject = {
|
apiObject = {
|
||||||
"text": twText,
|
"text": twText,
|
||||||
@ -215,6 +219,7 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
|
|||||||
"combinedMediaUrl": combinedMediaUrl,
|
"combinedMediaUrl": combinedMediaUrl,
|
||||||
"pollData": pollData,
|
"pollData": pollData,
|
||||||
"article": tweetArticle,
|
"article": tweetArticle,
|
||||||
|
"lang": lang
|
||||||
}
|
}
|
||||||
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())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user