简体   繁体   English

超过14条API搜索结果Twitter情感分析?

[英]More than 14 API search results for Twitter Sentiment Analysis?

I am currently using Tweepy to access the Twitter API for some sentiment analysis.我目前正在使用 Tweepy 访问 Twitter API 进行一些情绪分析。 However, when I run the following code:但是,当我运行以下代码时:

auth = tweepy.OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_token,access_token_secret)
api = tweepy.API(auth, wait_on_rate_limit = True)


public_tweets = api.search('Donald Trump')

I only get 14 tweets ?我只收到14 条推文 Is There any way to retrieve more/specify that you want more??有没有办法检索更多/指定你想要更多? Any help would be much appreciated!!任何帮助将非常感激!!

Try using this:尝试使用这个:

auth = tweepy.OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_token,access_token_secret)
api = tweepy.API(auth, wait_on_rate_limit = True)

your_query = "your query"
public_tweets = api.search(your_query, count=100)

This is the maximum number of tweets you can get in one request.这是您可以在一个请求中获得的最大推文数量。 By default the count is set to 15. Moreover by default it shows the most recent 100 tweets which include your query.默认情况下,计数设置为 15。此外,默认情况下,它会显示最近的 100 条推文,其中包括您的查询。

If you need more than 100 Tweets you need either save the minimum id and set is as max_id attribute or use tweepy.cursor.如果您需要超过 100 条推文,则需要保存最小 id 并将其设置为 max_id 属性或使用 tweepy.cursor。 If you search you will find its tutorial on tweepy doc.如果您搜索,您会在 tweepy doc 上找到它的教程。

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

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