我如何解决此错误以使用Python抓取Twitter? [英] How could I solve this error to scrape Twitter with Python?
本文介绍了我如何解决此错误以使用Python抓取Twitter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为我的投资组合做一个个人项目,我想刮掉有关马克龙总统的推文,但我遇到了 twitterscrapper
这个错误.
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)
错误:
TypeError: query_tweets() got an unexpected keyword argument 'begindate'
我可以解决吗?
推荐答案
代码很好,问题在于您安装了 twitterscraper
版本错误.
The code is fine, the problem is that you installed the wrong version of twitterscraper
.
您可以使用 pip install twitterscraper --upgrade
或
pip install twitterscraper == 1.6.1
以确保它是最新版本
这篇关于我如何解决此错误以使用Python抓取Twitter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文