0

嘿,我正在尝试从 2020 年 10 月 1 日到今天发布推文,其中包含使用 tweepy 位于英国的“covid”关键字,并使用 pandas 库将其导出为 csv 文件,但我从 10 月 29 日得到的结果2020

这是代码过滤的一部分

import sys
import tweepy as tw
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler , Stream
import json



access_token = "xxxxxx"
access_token_secret = "xxxx"
consumer_key = "xxxxx"
consumer_secret = "xxxxx"

auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)


api = tw.API(auth, wait_on_rate_limit=True)

search_words ="covid"
date_since = "2020-10-01"
results = []

for tweet in tw.Cursor(api.search,tweet_mode='extended',q=search_words,lang="en",
                       since=date_since,geocode='51.745719,-1.236599,300km').items(9000):
    results.append(tweet.created_at)


print(results)

4

1 回答 1

0

默认情况下,Tweepy 的搜索方法使用 Twitter 的旧标准搜索 API,该 API 最多只能获取 7 天的推文历史记录。您将需要使用 30 天搜索选项(API.search_30_day方法),这还需要您在 Twitter 开发人员门户中配置高级搜索环境。请注意,高级搜索的搜索运算符和语法与标准搜索中的不同。

于 2020-11-13T12:34:10.823 回答