Repository navigation
Conversation
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
This was referenced Oct 18, 2026
Contributor
Author
|
@RuochenLyu / @LuciusChen Could you please review? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
twitter searchfails with:The underlying cause is a warning logged just before the error:
Without a valid
x-client-transaction-idheader, Twitter's GraphQL API returns 404 for search and other endpoints.Root Cause
xclienttransactioninitializes by parsing x.com HTML to find theondemand.schunk map (viaON_DEMAND_FILE_REGEX) andINDICESpatterns 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 containsondemand.s,twitter-site-verification, or theloading-x-animelements thatxclienttransactionrequires.Consequently,
ON_DEMAND_FILE_REGEX.search(html)returnsNoneand.group(1)raisesAttributeError: 'NoneType' object has no attribute 'group'.Fix
https://x.com/i/jf/still serves the legacy responsive-web HTML structure, which includes theondemand.schunk map and all other elementsxclienttransactiondepends on.Changing the URL fetched in
_ensure_client_transaction()from"https://x.com"to"https://x.com/i/jf/"restoresClientTransactioninitialization.References