【问题标题】:"Unexpected parameter: since" using tweepy“意外参数:因为”使用 tweepy
【发布时间】:2022-01-11 13:51:54
【问题描述】:

我在使用 tweepy 进行推文抓取时遇到问题。

这是代码

import tweepy
from textblob import TextBlob
import pandas as pd
import numpy as np
import re
import matplotlib.pyplot as plt
plt.style.use("fivethirtyeight")

#armazenar os dados de login
log = pd.read_csv("tokens.csv")




#Criar objeto de autenticação
authenticate = tweepy.OAuthHandler(consumerKey, consumerSecret)
#configurar o access token e o access secret
authenticate.set_access_token(accessToken, accessTokenSecret)

#Criar o objeto da API
api = tweepy.API(authenticate, wait_on_rate_limit=True)

#Coletar 2000 Tweets sobre Amazonia

search_term = "#Amazonia -filter:retweets"
#criar um cursor object
tweets = tweepy.Cursor(api.search_tweets, q=search_term, lang= "pt", since ="2018-01-01", until = "2021-12-01", tweet_mode="extended").items(2000)

#armazenar os tweets em uma variavel
all_tweets = [tweets for tweet in tweets]

我在运行代码时遇到以下错误:“Unexpected parameter: since”

有什么提示吗?

【问题讨论】:

  • 再次查看文档。从那以后,它似乎没有被调用的论点。也许它的另一个名字。

标签: python tweepy


【解决方案1】:

欢迎使用堆栈溢出!

tweepy 客户端使用来自 Twitter 的 api。随着 Twitter 更新其 api,参数可能会被删除。在这种情况下,如 here 所述,API 不再具有 since 参数。

我将您重定向到this Stack Overflow question,另一个用户在另一个端点上尝试了since 参数。此问题的答案提供了有关如何随时间过滤结果的很好示例。

【讨论】:

    猜你喜欢
    • 2023-03-15
    • 2022-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-24
    • 2021-12-02
    • 1970-01-01
    相关资源
    最近更新 更多