如何解决如何遍历 tweepy Cursor? For 循环不起作用
我试图用 tweepy 获取一些推文,但我一直收到错误 from selenium import webdriver
import time
import pyautogui
web = webdriver.Chrome()
print("trying to run the program")
yeah = web.get("https://www.google.com")
time.sleep(5)
searchbar = web.find_element_by_xpath('/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input')
if pyautogui.click() == web.find_element_by_xpath('/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input'):
searchbar.send_keys("yeah! We did it!")
。
我的代码:
'Cursor' object is not iterable
此代码不起作用,它可以在 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,wait_on_rate_limit_notify=True)
tweets = tweepy.Cursor(api.search,q="some-query",tweet_mode="extended",lang="it",result_type = "recent",count = 100)
对象外部调用 api.search
,但显然不会对结果进行分页,并且始终检索相同的 100 条推文。
我在这里错过了什么?我看到的所有示例都在 Cursor
循环中。
解决方法
在循环末尾添加 env->SetIntField(obj,fieldId,new_value)
起作用了。
tweets.next()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。