Home > Blockchain >  How do I scrape a Twitter list using snscrape?
How do I scrape a Twitter list using snscrape?

Time:01-31

I have to scrape tweets from this link enter image description here

It matched tweet list items.

https://twitter.com/i/lists/777955586638053376

enter image description here

2nd Item in CVS

https://twitter.com/Katina_Schubert/status/1620163364700962817

enter image description here

3rd Item in CSV

https://twitter.com/kaddinsky/status/1620163262179610624

enter image description here

*First Item in CSV is retweet the 3rd item.

CodePudding user response:

I review the code in github from the project and it should work with the list number:

from snscrape.modules.twitter import *

search = TwitterListPostsScraper("777955586638053376").get_items()
for item in search:
    print({
        "tweet": item.rawContent,
        "url": item.url,
    })

It works perfectly for me, with the following results:

{'tweet': '@hardysee \U0001fae2☺️', 'url': 'https://twitter.com/kaddinsky/status/1620173624295718912'}
{'tweet': '@N_Stansfield Nee geht ja schließlich um die direkte Zufahrt in die Tiefgarage            
  • Related