Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot import snscrape module in python

I want to scrape some twitter data inside jupyter notebook. My python version is 3.9+ and when I run:

import snscrape.modules.twitter as sntwitter

I got the following error:


/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'

Does anyone know how to fix this?

ps: I already double check the system requirement and download the package use

pip3 install snscrape
like image 533
Rieder Avatar asked May 13 '26 02:05

Rieder


1 Answers

I am also new to python, but I think you need to install the developer package using the below code:

pip3 install git+https://github.com/JustAnotherArchivist/snscrape.git
like image 152
JPpython Avatar answered May 14 '26 14:05

JPpython