WEIR

How to Scrape Twitter (X) in 2026: What Still Works

Four ways to scrape Twitter in 2026, what each costs and what breaks, and a tested standard-library Python script that pages X search results into a CSV.


Published · Updated · 7 min read · 阅读中文版

Cover image: Four ways that still work

You can still scrape Twitter in 2026 through the official X API, a logged-in scraper, your own archive, or a pay-per-result API.

This guide is for you if you need X (Twitter) posts in a spreadsheet or dataset. You get each route's cost and weak spot, then a tested Python script. We run Weir, the API it uses.

Run this to pull your first posts, with no X account and no cookies:

curl https://api.weirapp.io/v1/x/search \
  -H "Authorization: Bearer $WEIR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "Artemis", "fromUsers": ["NASA"], "limit": 5}'

How to scrape Twitter in 2026: 4 ways compared

Each route trades money against upkeep and risk, as of October 2026:

Route You need Cost to read What breaks
Official X API Developer account $0.005 per post Your budget
Open-source scrapers A logged-in X account Free in money Code and accounts
Your X archive Your own login Free Only your posts
Pay-per-result API An API key 1 Weir credit per post A third party

The steps below use the fourth.

1. The official X API

X's own API is the approved way to read other accounts' posts. Its pricing page lists these read rates, checked on 25 October 2026:

$0.005per post read
$0.010per profile or follower
3Mpost reads a month, then Enterprise

The page says "No subscriptions", so guides that quote a $100 Basic plan are out of date.

It suits you if you post or need X's full archive. Tweepy and X's xdk SDK call this API at the same rates, and our X API pricing guide has the rest.

2. Open-source scrapers: snscrape, twint, twikit, twscrape

They call the x.com web app's private endpoints, so they need no API key. Their state on GitHub and PyPI, 25 October 2026:

  • snscrape last shipped in June 2023, and issue #996, "All Twitter scrapes are failing", is still open.
  • twint is archived, with no release since 2020.
  • twikit last shipped in February 2025, and fixes for its 2026 bugs sit unmerged.
  • twscrape is maintained, but its README says it "requires authorized X/Twitter accounts".

The working ones log in with an account's session cookies. That account carries the risk, and the code breaks whenever X changes its web app.

Our twikit and twscrape alternatives guide goes deeper.

3. Your own posts: the X archive

If you only need your own account, skip scraping. X's help center says you request the archive under Settings and privacy, Account, Your X data, and it can take a few days.

Opening your Twitter archive shows how to turn it into a CSV.

4. A pay-per-result API with no login

A hosted API handles X access for you and bills per result, so you need only a key. We run one of these, Weir's Twitter scraper API. It is read-only, returns public data, and gives 5,000 free credits a month.

Step 1: Get a key and send one search in Python

Sign up with no card, create a key, and set it in your shell:

export WEIR_API_KEY="weir_live_..."

Start scrape_x.py with a function that posts a body and returns the page:

import csv, json, os, time, urllib.error, urllib.request
URL = "https://api.weirapp.io/v1/x/search"
HEADERS = {"Authorization": f"Bearer {os.environ['WEIR_API_KEY']}",
           "Content-Type": "application/json"}

def fetch_page(body):
    request = urllib.request.Request(URL, json.dumps(body).encode(), HEADERS, method="POST")
    try:
        with urllib.request.urlopen(request, timeout=60) as response:
            return json.load(response)
    except urllib.error.HTTPError as error:
        if error.code != 429:  # 402 means out of credits: stop, never retry
            raise
        time.sleep(int(error.headers.get("Retry-After", "5")))
        return fetch_page(body)  # rate limited: wait, then send it again

Step 2: Choose what to scrape

Add the search body. Each field comes from the API schema, and you need at least one search field, such as query or fromUsers:

BODY = {
    "query": "Artemis",               # words that must all appear
    "fromUsers": ["NASA"],            # optional: only these accounts
    "since": "2026-10-01T00:00:00Z",  # UTC
    "until": "2026-10-25T00:00:00Z",  # stops before this day
    "minLikes": 100,                  # X's own filter, approximate
    "language": "en",
    "sort": "latest",                 # or "top"
    "limit": 20,                      # X sends about 20 per page
}

minLikes uses X's own counts, which can lag. In our test, a 6,000-like floor dropped two NASA posts that already had more, so check likeCount if the floor must be exact.

Step 3: Page until nextCursor is null

Send meta.nextCursor back unchanged, and stop only when it is null:

def search_pages(body, max_pages=10):
    cursor = None
    for _ in range(max_pages):  # a cap on calls, so on credits
        page = fetch_page({**body, "cursor": cursor} if cursor else body)
        yield from page["data"]
        cursor = page["meta"].get("nextCursor")
        if not cursor:  # null is the only stop condition
            return

max_pages caps the walk, and so the bill. Our narrow test search ended on an empty page that cost 1 credit and returned null.

Step 4: Save the tweets to CSV

Finish the file with the CSV writer, then run python scrape_x.py:

FIELDS = ["id", "createdAt", "username", "text", "likeCount",
          "retweetCount", "replyCount", "viewCount", "url"]

with open("posts.csv", "w", newline="", encoding="utf-8") as file:
    writer = csv.DictWriter(file, fieldnames=FIELDS, extrasaction="ignore")
    writer.writeheader()
    for post in search_pages(BODY, max_pages=10):
        writer.writerow({**post, "username": post["author"]["username"]})

We ran this search on 25 October 2026 through Weir's MCP search_x tool, with limit: 5. Two pages came back with five posts each, at 6 credits a page. The first post, trimmed:

{
  "id": "2113776971603689874",
  "text": "We are not slowing down. 🚀\n\nOur Artemis III mission will send four astronauts ...",
  "url": "https://x.com/NASA/status/2113776971603689874",
  "createdAt": "2026-10-23T23:37:56.000Z",
  "author": { "username": "NASA" },
  "likeCount": 7061,
  "retweetCount": 926,
  "replyCount": 300,
  "viewCount": 1239075
}

Keep id as text: X ids are too long for a spreadsheet number.

What does it cost to scrape Twitter?

A search call costs 1 credit plus 1 per post, and X sends about 20 posts a page:

  • 1,000 posts on a topic: 50 calls, or 1,050 credits.
  • A daily pull of one account: about 22 credits for up to 20 new posts.
  • A 50,000-post thesis dataset: about 52,500 credits.

The 5,000 free monthly credits cover about 4,700 posts. For the thesis:

Reading 50,000 posts, October 2026
Official X API$250
Weir, $20 packabout $8.75

The $20 pack holds 120,000 credits that never expire.

This is not legal advice. Here is what X's terms say, and what two US cases decided.

X's terms forbid it. The version in force since 9 October 2026 says "crawling or scraping the Services in any form, for any purpose without our prior written consent is expressly prohibited". Break them and request over a million posts in a day, and they set damages of $15,000 per million.

X Corp. v. Bright Data. In May 2024, Judge William Alsup dismissed X's suit against Bright Data, which X accused of scraping and selling public posts. He held that the scraping claims clashed with copyright law, and warned of "information monopolies that would disserve the public interest".

X later revived some claims about the load on its servers, and the two sides settled in June 2025.

hiQ v. LinkedIn. In 2022, the Ninth Circuit found serious questions over whether scraping public profiles breaks the US anti-hacking law. A trial court then found hiQ broke LinkedIn's user agreement through scraping and fake accounts, and hiQ settled with a $500,000 judgment.

Neither case makes scraping safe. Both were about public data, and hiQ's fake accounts counted against it.

When not to use Weir

  • You need to post or reply. Weir is read-only; the official X API can write.
  • You need X's own permission. Weir is not licensed by X, so access can change.
  • You want the lowest price per post. TwitterAPI.io lists $0.15 per 1,000 tweets, less than our small packs.
  • You only want your own posts. The archive is free.

If it doesn't work

  • A KeyError or a 401: the key isn't set in this shell, or it was revoked.
  • A 400 on page two: the body changed, and a cursor only fits its own request.
  • An empty CSV: drop minLikes or widen the dates.

FAQ

Can you scrape Twitter for free?

Partly. Open-source scrapers cost nothing in money, but they put a logged-in account at risk. Your own archive is free. Weir's 5,000 free monthly credits cover about 4,700 posts, with no card.

Can you scrape Twitter without the API or an account?

Not reliably on your own: snscrape, the main logged-out scraper, has failed since June 2023. A hosted API needs only its key.

Can you scrape Twitter followers?

Yes, for public accounts. The X API charges $0.010 per follower, and Weir charges 1 credit per account. See exporting Twitter followers to CSV for the code.

Does snscrape still work in 2026?

No. Its Twitter scrapes have failed with "blocked (404)" since June 2023, with no fix released. twscrape is maintained but needs logged-in accounts.

Sources