{"id":24609,"library":"snscrape","title":"snscrape","description":"snscrape is a social network service scraper that supports Twitter, Reddit, Telegram, and more. Current version 0.7.0.20230622 targets Python 3.8+. It is actively maintained but has evolving API structures and breaking changes across versions.","status":"active","version":"0.7.0.20230622","language":"python","source_language":"en","source_url":"https://github.com/JustAnotherArchivist/snscrape","tags":["scraping","twitter","social-media","data-collection"],"install":[{"cmd":"pip install snscrape","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP requests","package":"requests","optional":false},{"reason":"HTML parsing","package":"lxml","optional":false},{"reason":"HTML parsing","package":"beautifulsoup4","optional":false}],"imports":[{"note":"snscrape is a namespace package; direct import of module required.","wrong":"import snscrape; snscrape.TwitterSearchScraper","symbol":"snscrape.modules.twitter.TwitterSearchScraper","correct":"from snscrape.modules.twitter import TwitterSearchScraper"}],"quickstart":{"code":"from snscrape.modules.twitter import TwitterSearchScraper\nfrom datetime import datetime\n\nscraper = TwitterSearchScraper('from:@elonmusk since:2022-01-01 until:2022-12-31')\nfor i, tweet in enumerate(scraper.get_items()):\n    if i >= 5:\n        break\n    print(tweet.url, tweet.date, tweet.content[:50])","lang":"python","description":"Scrapes recent tweets matching a query."},"warnings":[{"fix":"Change imports to `from snscrape.modules.<service> import ...`","message":"snscrape 0.7+ changed the import structure from `snscrape.snscrape` to `snscrape.modules.*`. Old code using `from snscrape import snscrape` will break.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Respect robots.txt, use polite delays, and consider official APIs for production.","message":"Twitter scraping may be blocked or rate-limited; snscrape does not officially support authenticated scraping. Using excessive requests can lead to IP blocks.","severity":"gotcha","affected_versions":"all"},{"fix":"Use service-specific scrapers like `TwitterSearchScraper` or `RedditScraper`.","message":"The `snscrape.base.Scraper` base class is subject to internal changes and not meant for direct use.","severity":"deprecated","affected_versions":"all"},{"fix":"Pin version and test scraping behavior regularly.","message":"snscrape may break if Twitter/X changes its HTML/JSON structure; no guarantees of long-term stability.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: `from snscrape.modules.twitter import TwitterSearchScraper`","cause":"Import path changed in 0.7+.","error":"ImportError: cannot import name 'TwitterSearchScraper' from 'snscrape'"},{"fix":"Create scraper: `scraper = TwitterSearchScraper(...)`, then `scraper.get_items()`.","cause":"Trying to call snscrape.get_item() directly; should use scraper instance method.","error":"AttributeError: module 'snscrape' has no attribute 'get_item'"},{"fix":"Add delays between requests, use proxies, or reduce request frequency.","cause":"Twitter API rate limiting or blocking.","error":"requests.exceptions.ConnectionError: HTTPSConnectionPool: Max retries exceeded with url: /graphql/..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}