Twitter API v2 Academic Python: Not able to see content of tweets

124 Views Asked by At

I am connecting to the Twitter API v2 Academic endpoint, and while it returns the count of tweets by day, I am not able to see the tweets themselves.

import searchtweets as tw

search_args = tw.load_credentials(".twitter_keys.yaml",
                                     yaml_key="search_tweets_v2",
                                     env_overwrite=False)

query = tw.gen_request_parameters(
    query = "#stonks -is:retweet -is:nullcast",
    results_per_call = 10,
    start_time = "2021-01-01", 
    end_time = "2021-01-02",
    tweet_fields = "id,created_at,text,author_id,context_annotations,entities,geo,lang,organic_metrics,public_metrics,source,next_token",
    granularity = "day"
)

tweets = tw.collect_results(
    query,
    max_tweets=10,
    result_stream_args=search_args
)

print(tweets)

The response I get to the query is

[{'data': [{'end': '2021-01-02T00:00:00.000Z', 'start': '2021-01-01T00:00:00.000Z', 'tweet_count': 310}], 'meta': {'total_tweet_count': 310}}]

I cant see how to access the 310 tweets (or even 10 as per my query).

Thank you

0

There are 0 best solutions below