fix: fetch authenticated /home for ClientTransaction init (new x-web frontend broke posting) - #80
Closed
zengbo wants to merge 1 commit into
Closed
fix: fetch authenticated /home for ClientTransaction init (new x-web frontend broke posting)#80zengbo wants to merge 1 commit into
zengbo wants to merge 1 commit into
Conversation
Logged-out x.com now serves the new x-web frontend (assets under abs.twimg.com/x-web/x-web/), which no longer references ondemand.s.<hash>.js. x-client-transaction needs that file plus the homepage verification meta and loading-x-anim SVGs to generate the X-Client-Transaction-Id header; without it CreateTweet fails with 'HTTP 0: Failed to create tweet' while read endpoints keep working. The authenticated /home page still serves the legacy responsive-web frontend with all signing inputs, so fetch it with the session's auth cookies. Auth is always available here since _ensure_client_transaction runs from TwitterClient.__init__. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Aa1vBaCBrYHvoBgp8SZLoV
Author
|
Closing as duplicate — #79 (2 days earlier) makes the same change, and #74 is an even more minimal fix that also comes with tests. Some verification data points that may help triage, from debugging this independently today:
|
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
Since early August 2026, every invocation logs:
and
CreateTweetfails most of the time withTwitter API error (HTTP 0): Failed to create tweet(a small fraction of posts slip through), while all read endpoints keep working.Root cause
Logged-out
x.comnow serves X's new x-web frontend (assets underabs.twimg.com/x-web/x-web/). That page no longer referencesondemand.s.<hash>.js, sox_client_transaction.get_ondemand_file_urlraises (ON_DEMAND_FILE_REGEXfinds no match — the.grouponNone). Without aClientTransaction, requests go out with noX-Client-Transaction-Idheader and X rejects tweet creation. Upstreamxclienttransaction1.0.3 (latest) has no fix yet.Fix
The authenticated
/homepage still serves the legacy responsive-web frontend containing all three signing inputs (twitter-site-verification meta,loading-x-animSVGs,ondemand.sreference). This PR makes_ensure_client_transactionfetchhttps://x.com/homewith the session's auth cookies. Auth is always available at that point since init runs fromTwitterClient.__init__. The cache path is unaffected (it stores raw HTML/JS and bypassesget_ondemand_file_url).Verification
ClientTransaction initializedlogged.twitter post+twitter deleteround-trip succeeds (was failing with HTTP 0 before).Note: if/when X migrates the logged-in page to x-web as well, the regexes will need a real update in
xclienttransaction; this keeps the CLI working until then.🤖 Generated with Claude Code
https://claude.ai/code/session_01Aa1vBaCBrYHvoBgp8SZLoV