简体   繁体   中英

Searching Top Tweets Using Tweepy

When I search tweets using Tweepy, I only get the latest tweets.

public_tweets = twitter.search_tweets('text to search', count=10, tweet_mode='extended')

I was wondering is there any way to get top tweets (first tab on mobile app) using its api?

You can set the result_type argument to 'popular' to get only the top tweets.

public_tweets = twitter.search_tweets('text to search', count=10, result_type='popular', tweet_mode='extended')

It is mixed between the top tweets and the more recent tweets by default.

For more information and to see the other possible values, you can read the documentation here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM