tweepy 搜索给出的结果多于 count 参数
tweepy search giving more result than count parameter
我正在使用 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)
以上代码不考虑计数参数并保持 运行 直到达到应用程序的请求速率限制并出现以下错误
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 00+ 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
更新了如下代码,它成功了。
for tweet in tweepy.Cursor(api.search,q=search+" -filter:retweets",lang="en").items(num_tweets):
我正在使用 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)
以上代码不考虑计数参数并保持 运行 直到达到应用程序的请求速率限制并出现以下错误
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 00+ 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
更新了如下代码,它成功了。
for tweet in tweepy.Cursor(api.search,q=search+" -filter:retweets",lang="en").items(num_tweets):