tags = pd.read_csv("tags.csv", header=None)
words = []
for i in range(tags.shape[0]):
words.append(str(tags[0][i]))
# Relevant #tags on Twitter
search_words = words
# Exclude retweets in our search
new_search = []
for i in range(len(search_words)):
new_search.append(search_words[i] + " -filter:retweets")
for i in range(len(new_search)):
# performs the search using the defined variables
for tweet in limit_handled(tweepy.Cursor(api.search,
q=new_search[i],
count=count,
tweet_mode='extended',
lang=lang,
geocode=geocode,
result_type=result_type,
include_entities=include_entities,
since=date_since,
until=date_until).items(totalTweets)):
在q中,是否可以使用迭代器作为参数搜索多个标签词?
tweepy.Cursor(q="一次一个字符串或多个")
我认为这可能是由于速率限制的限制,你有没有尝试设置wait_on_rate_limit为true,同时创建api。
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)