How could I solve this error to scrape Twitter with Python?

a 夏天 提交于 2021-02-11 14:18:33

问题


I'm trying to do a personal project for my portfolio, I would like to scrape the tweets about the president Macron but I get this error with twitterscrapper.

from twitterscraper import query_tweets
import datetime as dt
import pandas as pd

begin_date=dt.date(2020,11,18)
end_date=dt.date(2020,11,19)
limit=1000
lang='English'

tweets=query_tweets("#macron",begindate=begin_date,enddate=end_date,limit=limit,lang=lang)

Error:

TypeError: query_tweets() got an unexpected keyword argument 'begindate'

May I know how to solve it?


回答1:


The code is fine, the problem is that you installed the wrong version of twitterscraper.

You may update your package by using pip install twitterscraper --upgrade

or

pip install twitterscraper==1.6.1 for ensuring it is the latest



来源:https://stackoverflow.com/questions/64908317/how-could-i-solve-this-error-to-scrape-twitter-with-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!