问题
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