Repository navigation
Conversation
The root path now serves a lightweight logged-out shell without the ondemand.s bundle, so the ClientTransaction bootstrap (and therefore the x-client-transaction-id header) silently stopped working. Every header-gated GET 404s as a result: SearchTimeline, Followers, Following, Likes (GitHub issues jackwener#69, jackwener#73, jackwener#78, jackwener#88). Fix, verified end-to-end against the live API on 2026-09-29: - bootstrap from https://x.com/home instead of the root path - send the session cookie on the bootstrap request: /home WITHOUT a cookie is also a stripped 17KB shell; with a cookie it is the full 305KB page carrying the numeric module map + hash map (the header is derived from public page data, so the cookie does not weaken it) - require xclienttransaction>=1.0.3: 1.0.1's regex expects the old '"ondemand.s": "<hash>"' name->hash layout and cannot resolve the current numeric module index (get_ondemand_file_url returns None -> AttributeError); 1.0.3 uses ',<index>:"ondemand.s"' Adds offline regression tests for the bootstrap (route + cookie + resolved ondemand URL) and live smoke tests for the CT-gated reads. SearchTimeline was additionally moved to POST in 0.8.6+ (already in main); with this fix the GET form works again too.
X moved the web build from abs.twimg.com/responsive-web/client-web/* to abs.twimg.com/x-web/x-web/* (entry bundle + relative ./assets/*.js chunks). The queryId bundle scan only matched the old path, so live queryId resolution was silently dead. Match both layouts and follow the x-web entry bundle's ./assets/*.js chunks. (The current build no longer embeds queryId/operationName pairs, so this restores future-proofing rather than today's queryIds — those come from the community twitter-openapi file.)
…s, upstream stance) - Banner + badges: 'Maintained fork of public-clis/twitter-cli by c4nc', CI/version - 'About this fork': why (X Sept-2026 rebuild broke the CT header), what's in it (CT bootstrap, xclienttransaction>=1.0.3, x-web bundle scan, 5 cherry-picked community fixes), version 0.8.6 - Credits: original jackwener (Apache-2.0), xclienttransaction author, and the three community authors of the cherry-picked PRs; our jackwener#93 contribution - Upstream stance: not forking to fork; archive if original resumes + ships the fix - Install + skills sections (EN + 中文): fork = working version, upstream = PyPI (missing the fix); install/clone/skill commands point at c4nc
|
I independently re-verified this PR's two central claims while triaging all 29 open PRs, and both hold up. Sharing the evidence in case it helps a maintainer decide, since this is the one PR that unblocks every header-gated read. 1. The signed-out page really has no The root page is now a Vite/TanStack-Router SPA ( 2. The I forced the venv back to That is the only negative-control test in the whole cluster — the version bump is load-bearing, not cosmetic. On CI: the red status on this PR is not a code failure. Two small things that would help it land, both in #102 (independent of this PR): a job Caveat I could not close: no decryptable X session exists on this machine, so the 305 KB authenticated |
Summary
Restores the
x-client-transaction-idheader on current X pages. Since X's Sept 2026 web rebuild, the root path serves a stripped logged-out shell without theondemand.sbundle, soClientTransactioninit fails and the header is never generated. Every header-gated GET 404s as a result:SearchTimeline—twitter search(HTTP 404)Followers/Following/Likes(HTTP 404)Tracking: #69, #73, #78, #88 (all same root cause, still open).
Related PRs #74/#84/#86/#89/#90/#91 target the same bootstrap; this one is the variant verified end-to-end against the live API (2026-09-29), including the point the others miss:
Root cause — verified empirically
ondemand.spresent?GET /no cookieGET /homeno cookieGET /home+ session cookieTwo changes are therefore both required:
https://x.com/homewith the session cookie sent (it is the cookie that makes the page un-stripped — not just the path change).xclienttransactionfloor to>=1.0.3: the pinned 1.0.1 expects the old"ondemand.s": "<hash>"name→hash map; the current page uses a webpack numeric module map (59924:"ondemand.s"+ separate index→hash map), which only 1.0.3 (released 2026-06-26) parses. Verified: 1.0.1 →get_ondemand_file_urlreturnsNone→AttributeError; 1.0.3 resolves the bundle and generates a valid id.Security note: the generated id is derived from public page data (site-verification key + bundle animation frames). The bootstrap cookie is only what distinguishes the full page from the stripped shell — it does not weaken the id.
Changes
client.py: CT bootstrap fetches/homewithCookie: auth_token=…; ct0=…(full browser cookie string when available)pyproject.toml/uv.lock:xclienttransaction >=1.0.1→>=1.0.3graphql.py: extend the queryId bundle scan to the newabs.twimg.com/x-web/x-web/*layout (entry bundle + relative./assets/*.jschunks) — the oldresponsive-web/client-web-only regex matches nothing now, silently killing live queryId re-resolutiontests/test_client.py: offline regression tests — bootstrap hits/homewith the cookie, resolves the ondemand URL, real-parser resolution of the current layouttests/test_smoke.py: live smoke tests for the CT-gated reads (followers,following)Verification
ruff check .— cleanmypy twitter_cli— cleanpytest -q— 245 passed (includes new CT tests; run under 1.0.1 the new parser test fails withAttributeError, under 1.0.3 it passes)pytest -m smoke -v— 8/8 live API tests pass (search, feed, followers, following, user, user-posts, whoami, status) — run with a real browser cookie sessiontwitter search,followers,following,likesall return data after the fix (previously 404/422)Note:
mainalready routes SearchTimeline through POST (0.8.6, May), which works without the header — that's why search "half-worked" while followers/following/likes stayed broken. This fix restores the GET path and the header for all endpoints, and the bundle-scan fix restores the live queryId re-resolution fallback.