You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm seeing truncated tweet texts, even though I've explicitly filtered out retweets in my query.
To Reproduce
importrequestsimportosimportjson# To set your environment variables in your terminal run the following line:# export 'BEARER_TOKEN'='<your_bearer_token>'bearer_token=os.environ.get("BEARER_TOKEN")
search_url="https://api.twitter.com/2/tweets/search/recent"# Optional params: start_time,end_time,since_id,until_id,max_results,next_token,# expansions,tweet.fields,media.fields,poll.fields,place.fields,user.fieldsquery_params= {'query': '(from:lightningai -is:retweet)',
'tweet.fields': 'author_id,created_at,public_metrics',
'max_results':10}
defbearer_oauth(r):
""" Method required by bearer token authentication. """r.headers["Authorization"] =f"Bearer {bearer_token}"r.headers["User-Agent"] ="v2RecentSearchPython"returnrdefconnect_to_endpoint(url, params):
response=requests.get(url, auth=bearer_oauth, params=params)
print(response.status_code)
ifresponse.status_code!=200:
raiseException(response.status_code, response.text)
returnresponse.json()
defmain():
json_response=connect_to_endpoint(search_url, query_params)
print(json.dumps(json_response, indent=4, sort_keys=True))
if__name__=="__main__":
main()
Expected behavior
I would expect all the tweet texts returned to be the full text.
Additional context
An example of what I'm seeing, where it's clear that the tweet is truncated at StableLM, Pythia,...:
{'author_id': '1157283331509235713', 'created_at': '2023-05-09T15:13:09.000Z', 'edit_history_tweet_ids': ['1655954064474279938'], 'id': '1655954064474279938', 'public_metrics': {'impression_count': 14351, 'like_count': 113, 'quote_count': 3, 'reply_count': 3, 'retweet_count': 29}, 'text': '⚡Lit-Parrot 🦜 - the simplest implementation of the best open-source language models out there is now available!\n\nFresh out of the cage👉 https://t.co/TWSVqU6izY\n\n💡“nanoGPT” minimal\n🛠️hackable\n📜comes with pre-training + finetuning scripts\n\nShips with StableLM, Pythia,… https://t.co/RypG8NLUgy https://t.co/nW2W80Cwup'}
Any guidance would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm seeing truncated tweet texts, even though I've explicitly filtered out
retweets
in my query.To Reproduce
Expected behavior
I would expect all the tweet texts returned to be the full text.
Additional context
An example of what I'm seeing, where it's clear that the tweet is truncated at
StableLM, Pythia,...
:Any guidance would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered: