Scraping libraries
snscrape, twikit, twscrape and Tweepy in 2026: Which Twitter Scraping Libraries Still Work
Updated:
Quick Answer
On December 1, 2026 we installed six Python libraries for X (Twitter) data and asked each for recent posts from @nasa, without logging in an X account. None returned a post. snscrape was blocked with 404, twint would not start, twikit failed before login, and ntscraper found no working Nitter instance. twscrape and Tweepy ran and asked for credentials: twscrape for X accounts, Tweepy for an official X API key. Those two are maintained and are built to work once you supply them. If you want the posts without managing X accounts or paying official rates, a scraping API such as TwexAPI returns them for about $0.05 per 1,000.
Test results
| Library | Latest release | What happened in our test | What it needs |
|---|---|---|---|
| snscrape | 0.7.0.20230622 (June 2023); last commit November 2023 | Python 3.12: crashed on import. Python 3.11: X answered 404 to every search request and snscrape gave up after 4 tries | Logged-out access to X search, which X no longer gives |
| twint | 2.1.20 (April 2020); repository archived | Did not start: a missing module on Python 3.12, and two dependency errors on Python 3.8 | Nothing we could supply; the project is archived |
| twikit | 2.3.3 (February 2025); last commit March 2026 | Raised "Couldn't get KEY_BYTE indices" before any login, on the release and on the current source | An X account to log in with (username, email and password); we could not get that far |
| twscrape | 0.21.1 (November 23, 2026); active | Ran, logged "No active accounts. Stopping..." and returned 0 posts | One or more X accounts added to its pool; not tested with accounts |
| Tweepy | 4.17.0 (July 2026) | 401 Unauthorized without a valid token | Official X API credentials; reads are billed at X’s rates |
| ntscraper | 0.4.0 (May 2025) | Checked 7 Nitter instances, found none working and stopped with an IndexError | A working public Nitter instance |
How we tested: each library was installed from PyPI into a clean virtual environment on macOS with Python 3.12 (also 3.11 for snscrape and 3.8 for twint, since both predate 3.12) and run from one network on December 1, 2026. We did not log in or add an X account, so twikit, twscrape and Tweepy were tested only up to the point where they ask for credentials. Results can differ by IP address, and they change whenever X or a library updates.
Is snscrape still working in 2026?
Not for X (Twitter) in our test. snscrape reads X without an account, using a guest token. It still obtained a token, but X answered 404 to every search request, and the user scraper relies on the same search request. On Python 3.12 the PyPI release does not get that far: it fails on import, because it calls a function Python removed in 3.12.
The newest release is from June 2023 and the last commit from November 2023. Installing the current source instead of the release gave the same 404.
$ snscrape --jsonl --max-results 5 twitter-user nasa
Error retrieving https://twitter.com/i/api/graphql/.../SearchTimeline?...: blocked (404), retrying
snscrape.base.ScraperException: 4 requests to https://twitter.com/i/api/graphql/.../SearchTimeline?... failed, giving up.
# The same command on Python 3.12
AttributeError: 'FileFinder' object has no attribute 'find_module'Source: snscrape on GitHub
twint: archived, and a fresh install no longer starts
twint’s last release is 2.1.20 from April 2020, and its GitHub repository is archived, so it is read-only. A fresh install did not start in three tries. On Python 3.12 it stopped on a missing module. On Python 3.8 it stopped on a newer dependency that no longer supports 3.8, and with that dependency pinned to an old version it stopped on another. We never reached a request to X, so this test says nothing about what X would answer.
$ twint -u nasa --limit 5
# Python 3.12
ModuleNotFoundError: No module named 'async_timeout'
# Python 3.8
TypeError: 'type' object is not subscriptable (from fake_useragent)
# Python 3.8, fake-useragent pinned to 0.1.11
AttributeError: __enter__ (from "with timeout(120):")Source: twint on GitHub (archived)
twikit: "Couldn't get KEY_BYTE indices" before login
twikit logs in to X as a normal account with a username, email and password, and can also keep the session in a cookies file. In our test it did not reach the login step. Both its Client and its GuestClient raised "Couldn't get KEY_BYTE indices" on the first request, which comes from the code that prepares a request header from X’s home page. Version 2.3.3 from PyPI and the current source from GitHub behaved the same, and the project’s issue tracker has several reports of this error.
So we cannot say how twikit behaves once logged in. If you use it, remember that it sends requests as the account you log in, and that account carries the risk if X restricts it.
client = Client("en-US")
await client.search_tweet("from:nasa", "Latest")
# Exception: Couldn't get KEY_BYTE indices
guest = GuestClient()
await guest.activate()
# Exception: Couldn't get KEY_BYTE indicesSource: twikit on GitHub
twscrape: maintained, and it needs X accounts
twscrape is the most active of the six: version 0.21.1 came out on November 23, 2026 and the repository had commits the day before our test. It works through a pool of X accounts that you add, by login or by cookies, and spreads requests across them. With an empty pool it did exactly what it says: it logged that there were no active accounts and returned nothing.
We did not add accounts, so we did not test how well it works with them. What you take on is the accounts themselves: creating or buying them, keeping them logged in, and replacing any that X locks.
api = API()
await api.pool.stats()
# {'total': 0, 'active': 0, 'inactive': 0}
await gather(api.search("from:nasa", limit=5))
# WARNING | twscrape.accounts_pool - No active accounts. Stopping...
# []Source: twscrape on GitHub
Tweepy: works with the official X API, at official prices
Tweepy is not a scraper. It is a client for the official X API, so it needs X API credentials, and without a valid token every call returns 401 Unauthorized. The library is free; the API behind it is not. X’s pricing page lists no free plan and charges $0.005 per post read, $5.00 per 1,000 posts (read December 1, 2026).
client = tweepy.Client(bearer_token="not-a-real-token")
client.search_recent_tweets("from:nasa", max_results=10)
# tweepy.errors.Unauthorized: 401 UnauthorizedSource: X API pricing (official)
ntscraper and Nitter
ntscraper reads X through public Nitter instances. When it starts, it tests the instances it knows about and picks a working one. In our test it tried 7, found none working and stopped with "IndexError: Cannot choose from an empty sequence". It depends on other people’s Nitter servers staying up, which you do not control.
Source: ntscraper on GitHub
Why these libraries break
X shut down guest accounts in early 2024, so tools that read X without logging in, and the public Nitter instances built on the same access, stopped working. What is left needs either X accounts that you supply or the official API. Libraries that log in as an account also have to follow every change X makes to its site, which is why an error can appear overnight and stay until the maintainers ship a fix.
What you can use instead
| Option | Cost per 1,000 posts | What you manage |
|---|---|---|
| twscrape with your own X accounts | Software is free | The X accounts, proxies, and fixes when X changes its site |
| Tweepy with the official X API | $5.00, capped at 3M post reads a month | A developer account and prepaid X credits |
| An Apify Tweet Scraper Actor | $0.14 to $0.40 | An Apify account; each scrape runs as an Actor job |
| TwexAPI | ~$0.05, by keyword search or from account timelines | An API key |
Apify prices are from the two Actors compared on our Twitter scraper page, as read on November 27, 2026; X’s price was read on December 1, 2026.
The same task with TwexAPI
This is the request we gave every library, recent posts from @nasa, as one HTTP call. It returned 20 posts on December 1, 2026. A page of 20 uses 100 Credits, about $0.001, and new accounts get 20,000 Credits free.
import os
import requests
res = requests.post(
"https://api.twexapi.io/twitter/advanced_search/page",
headers={"Authorization": f"Bearer {os.environ['TWEXAPI_KEY']}"},
json={"searchTerms": ["from:nasa"], "sortBy": "Latest"},
timeout=30,
)
res.raise_for_status()
for post in res.json()["data"][:5]:
print(post["created_at"], post["favorite_count"], post["text"][:60].replace("\n", " "))FAQ
Is snscrape still working in 2026?
Not for X (Twitter) in our test on December 1, 2026. X answered 404 to every search request and snscrape gave up after 4 tries. On Python 3.12 the PyPI release also fails on import. Its newest release is from June 2023.
What is a good snscrape alternative?
It depends on what you can supply. twscrape is maintained and works through X accounts that you add. Tweepy uses the official X API at $5.00 per 1,000 posts. A scraping API such as TwexAPI needs only an API key and costs about $0.05 per 1,000 posts.
Why does twikit say "Couldn't get KEY_BYTE indices"?
In our test on December 1, 2026 both twikit 2.3.3 and its current source raised that error on the first request, before login. It comes from the code that prepares a request header from X’s home page, and the project’s issue tracker has several reports of it. We did not find a setting that avoided it.
Does twscrape still work?
It is actively maintained: version 0.21.1 was released on November 23, 2026. It needs X accounts in its pool, and with none it returned no data in our test. We did not test it with accounts.
Is Tweepy free?
The library is free and open source. The official X API it calls is not: X’s pricing page lists no free plan and charges $0.005 per post read (read December 1, 2026).
Is there a Tweepy alternative that does not need an X developer account?
Yes. Tweepy only talks to the official X API. A third-party API such as TwexAPI returns public posts, profiles and followers with its own API key, which you get by signing up with an email or Google account.
Can I get banned for using twikit or twscrape?
Both send requests as the X accounts you give them, so those accounts carry the risk if X restricts automated use. Many people use separate accounts for this reason. A scraping API does not use your X account.
Is TwexAPI affiliated with these projects or with X?
No. TwexAPI is an independent third-party provider of public social data. It is not affiliated with snscrape, twint, twikit, twscrape, Tweepy or ntscraper, or with X Corp.
Related Guides
Sources
Prices change. Confirm current rates on each provider’s pricing page before you buy. TwexAPI is an independent provider and is not affiliated with or endorsed by X Corp.