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

Question:

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?

Asked By: dobro sam

||

Answers:

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

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

or

pip install twitterscraper==1.6.1 to ensure it is the latest

Answered By: kennysliding