Skip to content

fix: fetch /i/jf/ for ClientTransaction init after x.com Vite migration - #98

Open
jmargieh wants to merge 1 commit into
jackwener:mainfrom
jmargieh:fix/x-com-homepage-migration
Open

jmargieh wants to merge 1 commit into
jackwener:mainfrom
jmargieh:fix/x-com-homepage-migration

Conversation

@jmargieh

Copy link
Copy Markdown
Contributor

Problem

Running twitter search fails with:

🔍 Fetching 'Claude Code' (Top) (50 tweets)...
❌ Twitter API error (HTTP 404): Twitter API error 404:

The underlying cause is a warning logged just before the error:

Failed to init ClientTransaction: 'NoneType' object has no attribute 'group'

Without a valid x-client-transaction-id header, Twitter's GraphQL API returns 404 for search and other endpoints.

Root Cause

xclienttransaction initializes by parsing x.com HTML to find the ondemand.s chunk map (via ON_DEMAND_FILE_REGEX) and INDICES patterns needed to generate transaction IDs.

x.com recently migrated its homepage (https://x.com) to a new Vite-bundled app (/x-web/ path). The new HTML no longer contains ondemand.s, twitter-site-verification, or the loading-x-anim elements that xclienttransaction requires.

Consequently, ON_DEMAND_FILE_REGEX.search(html) returns None and .group(1) raises AttributeError: 'NoneType' object has no attribute 'group'.

Fix

https://x.com/i/jf/ still serves the legacy responsive-web HTML structure, which includes the ondemand.s chunk map and all other elements xclienttransaction depends on.

Changing the URL fetched in _ensure_client_transaction() from "https://x.com" to "https://x.com/i/jf/" restores ClientTransaction initialization.

References

x.com/home now serves a new Vite-bundled app (x-web) that no longer
contains the ondemand.s chunk map, INDICES pattern, or
twitter-site-verification meta tag required by xclienttransaction.

Fetching https://x.com/i/jf/ instead still returns the legacy
responsive-web HTML structure, fixing ClientTransaction init and
restoring x-client-transaction-id header generation — which Twitter's
GraphQL API now requires for search and other endpoints.

Ref: iSarabjitDhiman/XClientTransaction#47
Ref: iSarabjitDhiman/XClientTransaction#48
@jmargieh

jmargieh commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@RuochenLyu / @LuciusChen Could you please review?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant