【问题标题】:tweepy search giving more result than count parametertweepy 搜索比计数参数提供更多结果
【发布时间】:2017-06-12 06:01:59
【问题描述】:

我正在使用 tweepy API 来搜索推文。我的代码如下所示

num_tweets=10
search = 'tesla stock'

num = 0

for tweet in tweepy.Cursor(api.search,q=search+" -filter:retweets",count=num_tweets,lang="en").items():
    num +=1
    print(num)
    print(tweet.text)

上面的代码不考虑 count 参数并一直运行,直到应用程序的请求速率限制达到以下错误

TweepError:Twitter 错误响应:状态码 = 429

我错过了什么吗?

以下是部分结果。看到结果数多了很多:

1
We have 100 of the Tesla adapters in stock:  
2
@erikher101095 also PLEASE BUY TESLA STOCK!!
3
#Tesla $TSLA is the most exciting stock. but it’s not as 24/7 non-stop global exciting as crypto ???? #cryptotrifecta

....

1764
Love Tesla cars & stock, but $7500+ rebates fueled Tesla growth & Musk just kicked taxpayers firmly in the a**! 
1765
Tesla's Model 3 could reverse its stock slide #ElonMusk #ElonMusk 
1766
Tesla Inc (TSLA) Stock at Risk as Trump Exits Paris Accord 

【问题讨论】:

    标签: python twitter tweepy


    【解决方案1】:

    像下面这样更新了代码,它工作了。

    for tweet in tweepy.Cursor(api.search,q=search+" -filter:retweets",lang="en").items(num_tweets):
    

    【讨论】:

      猜你喜欢
      • 2018-10-17
      • 1970-01-01
      • 2020-01-30
      • 2017-11-17
      • 1970-01-01
      • 2013-10-21
      • 2020-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多