【问题标题】:Tweepy filter dosen't show the all result between two datesTweepy 过滤器不显示两个日期之间的所有结果
【发布时间】:2021-02-25 03:58:08
【问题描述】:

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

这是对代码进行过滤的部分

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)

【问题讨论】:

    标签: python-3.x twitter data-mining tweepy twitterapi-python


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-01
      • 1970-01-01
      • 2021-04-23
      • 1970-01-01
      • 2012-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多