简体   繁体   English

使用 Tweepy 搜索热门推文

[英]Searching Top Tweets Using Tweepy

When I search tweets using Tweepy, I only get the latest tweets.当我使用 Tweepy 搜索推文时,我只会得到最新的推文。

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?我想知道有没有办法使用它的 api 来获得热门推文(移动应用程序上的第一个标签)?

You can set the result_type argument to 'popular' to get only the top tweets.您可以将result_type参数设置为'popular'以仅获取热门推文。

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 .如需更多信息并查看其他可能的值,您可以阅读此处的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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