【问题标题】:Cannot import snscrape module in python无法在 python 中导入 snscrape 模块
【发布时间】:2021-12-15 21:00:27
【问题描述】:

我想在 jupyter notebook 中抓取一些 twitter 数据。我的 python 版本是 3.9+,当我运行时:

import snscrape.modules.twitter as sntwitter

我收到以下错误:


/opt/homebrew/lib/python3.9/site-packages/snscrape/modules/telegram.py in <module>
     23 
     24 @dataclasses.dataclass
---> 25 class TelegramPost(snscrape.base.Item):
     26         url: str
     27         date: datetime.datetime

/opt/homebrew/lib/python3.9/site-packages/snscrape/modules/telegram.py in TelegramPost()
     30         linkPreview: typing.Optional[LinkPreview] = None
     31 
---> 32         outlinksss = snscrape.base._DeprecatedProperty('outlinksss', lambda self: ' '.join(self.outlinks), 'outlinks')
     33 
     34         def __str__(self):

AttributeError: module 'snscrape.base' has no attribute '_DeprecatedProperty'

有谁知道如何解决这个问题?

ps:我已经仔细检查了系统要求并下载了使用的包

pip3 install snscrape

【问题讨论】:

    标签: python api web-scraping twitter


    【解决方案1】:

    我也是python新手,但我认为您需要使用以下代码安装开发者包:

    pip3 install git+https://github.com/JustAnotherArchivist/snscrape.git
    

    【讨论】:

      猜你喜欢
      • 2014-08-09
      • 2020-07-02
      • 2022-09-27
      • 2013-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-28
      相关资源
      最近更新 更多