Repository navigation
feat: absorb community PRs, issue fixes, and x.com resilience updates - #106
Merged
Merged
Conversation
…y cache, harden CI - Raise curl_cffi floor to >=0.15.0 (resolves GHSA-qw2m-4pqf-rmpp / CVE-2026-33752, closes #100) - Raise xclienttransaction floor to >=1.0.3 for X's numeric webpack module map - Enforce owner-only permissions (0600 files / 0700 dir) on tweet and transaction caches - Make auth path tests portable across POSIX/Windows - Harden CI workflow (minimal permissions, concurrency, timeouts, ubuntu-24.04, Python 3.13) Absorbs #102, #103, and dependency updates from #91/#93. Co-authored-by: axsddlr <axsddlr@users.noreply.github.com> Co-authored-by: Canc <luca.canc@gmail.com> Co-authored-by: Stoner <stoner@StonerdeMacBook-Air.local>
…s, fail-closed unsigned POSTs - Bootstrap ClientTransaction from authenticated https://x.com/home with unauthenticated fallback to https://x.com/i/jf/ (handles X's Vite x-web migration on anonymous / and /home) and never leak cookies to CDN assets - Refresh FALLBACK_QUERY_IDS against current twitter-openapi IDs and add UserByRestId; support TWITTER_QID_<OP> env overrides and 24h owner-only disk cache for live-resolved queryIds - Scan both responsive-web/client-web and x-web/x-web bundles (following ./assets/*.js chunks) via /i/jf/ and / - Treat GraphQL "Query: Unspecified" / persisted-query-not-found errors as stale queryIds and retry once with live lookup on GET and POST (fixes #59) - Fail closed on unsigned POST requests when x-client-transaction-id is unavailable (overrideable with TWITTER_ALLOW_UNSIGNED=1, mitigates #72) - Prefer chrome136 TLS impersonation target when available in curl_cffi Absorbs #74, #77, #79, #82, #83, #84, #86, #89, #90, #91, #93, #98, #99, #101, and query-ID/transaction practices from quangdang46/twitter_cli. Closes #59, #69, #73, #78, #88. Co-authored-by: Lucius <chenyh572@gmail.com> Co-authored-by: Canc <luca.canc@gmail.com> Co-authored-by: Jawad Margieh <J.margieh@gmail.com> Co-authored-by: Kage <oxkage@users.noreply.github.com> Co-authored-by: Ahmed Elshaabany <ahmed.elshaabany@gmail.com> Co-authored-by: Perry Huang <perry@gnuhpc.org> Co-authored-by: LiuWei <liuweixh@gmail.com> Co-authored-by: Abdurrahman Özkan <ozkanabdurrahmann@gmail.com> Co-authored-by: Blacksuite <larszx@outlook.com> Co-authored-by: GodfreyPrince <GodfreyPrince@users.noreply.github.com> Co-authored-by: Mckgare0717 <mckinnonrebello@gmail.com> Co-authored-by: Stoner <stoner@StonerdeMacBook-Air.local> Co-authored-by: Trần Quang Đãng <91641923+quangdang46@users.noreply.github.com>
…E_STRING, and better diagnostics - Support TWITTER_CHROMIUM_USER_DATA_DIR for ungoogled-chromium and custom Chromium profiles (discovers both Cookies and Network/Cookies, passes matching Local State key file, closes #61) - Add Vivaldi and Zen browser cookie extraction (in-process + subprocess, with profiles.ini priority and Linux Flatpak/XDG discovery for Zen) - Support TWITTER_COOKIE_STRING env var so headless/SigCLI/Windows users can supply a full cookie header without losing write/226 protection (#58) - Improve Windows Chrome/Edge >=127 App-Bound Encryption diagnostics with actionable workarounds (addresses #28, #46, #66) Absorbs #76, #92, #95, auth diagnostics from #104, and full-cookie env support inspired by #58 and quangdang46/twitter_cli. Co-authored-by: Lucius <chenyh572@gmail.com> Co-authored-by: RiriAgent <ririagent@users.noreply.github.com> Co-authored-by: Aditya Gupta <adityagupta2087@gmail.com> Co-authored-by: axsddlr <axsddlr@users.noreply.github.com> Co-authored-by: Trần Quang Đãng <91641923+quangdang46@users.noreply.github.com>
…ation, article rich content, numeric user IDs - Add author followers/following counts (#57) and optional viewer follow state (viewerFollowing / viewerFollowedBy) - Expose possiblySensitive and per-media warning labels (adultContent, graphicViolence, otherWarning) plus optional posterUrl, altText, and durationMs (#87 + quangdang46/twitter_cli) - Expose thread relationship fields (conversationId, inReplyToStatusId, inReplyToUserId, inReplyToScreenName) and --cursor / pagination.nextCursor on `twitter tweet` (closes #105) - Validate TweetDetail responses contain the requested focal tweet and order it first, returning structured not_found instead of empty success (closes #53) - Support post-legacy UserByRestId shapes (profile_bio, website, relationship_counts, tweet_counts, action_counts) and accept numeric user IDs in fetch_user() - Add Draft.js article rich content parsing (DIVIDER, TWEET, inline Bold/Italic/Code/Strikethrough with overlap-safe link rendering) and `twitter bookmarks --cursor` pagination Absorbs #57, #70, #75, #87, and live-payload audit fixes from quangdang46/twitter_cli. Closes #53, #105. Co-authored-by: edwinbernadus <bernadus.edwin@gmail.com> Co-authored-by: Lucius <chenyh572@gmail.com> Co-authored-by: Li Chenxi <me@ayayaya.org> Co-authored-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com> Co-authored-by: Trần Quang Đãng <91641923+quangdang46@users.noreply.github.com>
…ig, news, and doctor - Raise user-list pagination safety ceiling to 10000 and honour explicit --max on followers/following instead of clamping to rateLimit.maxCount (closes #50) - Resolve ~/.twitter-cli/config.yaml between cwd and package defaults - Add root --time relative|absolute|iso option and display.time config (closes #35) - Add `twitter completion bash|zsh|fish` using Click shell completion (closes #36) - Add `twitter news` command for Explore > News stories (closes #47) - Add `twitter doctor [--refresh]` diagnostic command (never leaks secrets) - Normalize tweet URLs consistently across like/retweet/bookmark/delete Absorbs #63, #104, and config/doctor/normalization practices from quangdang46/twitter_cli. Closes #35, #36, #47, #50. Co-authored-by: axsddlr <axsddlr@users.noreply.github.com> Co-authored-by: Ankit Ranjan <arstejas7@gmail.com> Co-authored-by: Trần Quang Đãng <91641923+quangdang46@users.noreply.github.com>
…icle-publish - Support chunked video upload (tweet_video, up to 512 MB, 4 MB APPEND chunks, async STATUS polling) and add --video / -V to post, reply, and quote (closes #13) - Add twitter-text v3 weighted character counting and automatic CreateNoteTweet routing for posts/quotes exceeding 280 weighted chars (closes #54) - Add `twitter article-publish <file.md> --title ... [--draft]` with Markdown-to-Draft.js conversion Absorbs #60, #62, #64, #65, #96. Closes #13, #54. Co-authored-by: jollyroger1480 <jollyroger1480@users.noreply.github.com> Co-authored-by: rakei076 <rakei076@users.noreply.github.com> Co-authored-by: hhh2210 <hzy2210@gmail.com>
…, SCHEMA.md - Export clean public Python library API from twitter_cli.__init__ (TwitterClient, get_cookies, load_config, filter_tweets, models, exceptions, serializers) and add import-surface tests (addresses #9). - Document updated structured output fields in SCHEMA.md (possiblySensitive, media sensitivity/poster/altText/durationMs, author followers/following & viewer follow flags, thread metadata, bookmarks/tweet nextCursor, news, doctor, article-publish). - Update README.md (English & Chinese) and SKILL.md for all newly absorbed features, browsers, auth methods, environment variables, and Python 3.10–3.13 CI matrix. Co-authored-by: axsddlr <axsddlr@users.noreply.github.com> Co-authored-by: hhh2210 <hzy2210@gmail.com> Co-authored-by: Lucius <chenyh572@gmail.com> Co-authored-by: RiriAgent <ririagent@users.noreply.github.com> Co-authored-by: Aditya Gupta <adityagupta2087@gmail.com> Co-authored-by: Li Chenxi <me@ayayaya.org> Co-authored-by: Trần Quang Đãng <91641923+quangdang46@users.noreply.github.com>
…parser/text edge cases, and docs Addresses findings from full adversarial code review of PR #106: - Cache security (`cache.py`, `client.py`, `graphql.py`): replace in-place truncating writes with atomic `O_CREAT | O_EXCL | O_NOFOLLOW` sibling temp file + `os.replace`, create cache dirs with `0o700`, and preserve `created_at` on incremental queryId disk merges while replacing cleanly on `refresh_query_ids()`. - GraphQL & ClientTransaction (`graphql.py`, `client.py`): pass `exclude_ids` on stale queryId retries so lagged `twitter-openapi` IDs fall through to live `_scan_bundles`; anchor Vite `x-web` asset URLs to `/x-web/x-web/` (fixes `/assets/assets/` 404); recognize HTTP 400 stale-query errors; prefer unauthenticated `/i/jf/` first, validate `ClientTransaction(...)` inside the candidate loop, and avoid caching authenticated `/home` HTML on disk. - TweetDetail, media upload & deeplinks (`client.py`): return `([], None)` when `count <= 0` with `return_cursor=True`; place focal tweet first before slicing to `count` so replies with ancestors don't raise false `NotFoundError`; restore `tweet_gif` category + `STATUS` polling for GIFs; allowlist mp4/mov/webm video MIME types; reject 0-byte uploads; lower video chunk size to 2 MB (under 5 MB base64 cap); use `time.monotonic()` and guard `check_after_secs: null` in `STATUS` polling; fix `twitter://trending/<id>?...` and `twitter://search?...` deeplink parsing. - Auth (`auth.py`): sanitize `TWITTER_COOKIE_STRING` (`Cookie:` prefix, CR/LF, quotes) and rebuild cookie header when `TWITTER_AUTH_TOKEN`/`TWITTER_CT0` override or supplement it; add Flatpak `config/zen` path & normalize Windows Zen paths; check profile parent `Local State` first and try Chromium-family keychain loaders on non-Windows for `TWITTER_CHROMIUM_USER_DATA_DIR`; detect Windows DPAPI errors. - Parser, text, article & formatter (`parser.py`, `text.py`, `article.py`, `formatter.py`): map Draft.js UTF-16 code unit offsets to Python indices so emoji + links/styles round-trip cleanly; guard `null` nested user dicts & strings; restrict bare-URL matching to ASCII hostnames with common IANA TLDs (prevents `config.yaml`/`cli.py` misrouting to `CreateNoteTweet`); refine `©`/`®`, Geometric Shapes emoji, and repeated trailing URL trimming; support `###` headings, balanced-paren link URLs, inline-code/image/math preservation, and strict fenced-code opening in `article.py`; widen `--time iso` Stats column, render `print_article` time via `_render_time`, and reset `set_time_style(None)` to `"relative"`. - CLI, library API, docs & tests (`cli.py`, `__init__.py`, `SCHEMA.md`, `SKILL.md`, `README.md`, `pyproject.toml`, `tests/`): lazy PEP 562 exports in `__init__.py` and resilient `.client` import so `doctor` works when deps are missing; guard invalid tweet IDs with `InvalidInputError` across write commands; validate `article-publish` title/UTF-8/non-empty input, upfront media MIME/count checks, `news --max >= 1`, `doctor` error exit code + `query_ids` TTL, and `likes` own numeric ID check; fix `SCHEMA.md` `news` fields, `SKILL.md` `jq` queries, `README.md` `display.time` default & EN/ZH parity, `public-clis/twitter-cli` URLs; isolate `~/.twitter-cli` caches and `TWITTER_*` env vars in `tests/conftest.py` and add 25 regression tests.
Ari4ka
approved these changes
Nov 28, 2026
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.
Summary
Consolidates and cleanly integrates 30 open community PRs, 21 open issues, and recent x.com resilience practices from
quangdang46/twitter_cli(twr) into 7 atomic, reviewed, and fully tested commits — preserving fullCo-authored-by:attribution for every original contributor.Commit Breakdown
fix(deps,security): upgrade curl_cffi & xclienttransaction, owner-only cache, harden CI(a47589f)curl_cffi>=0.15.0(locked0.17.0, fixingGHSA-qw2m-4pqf-rmpp/ curl_cffi>=0.7 floor and 0.14.0 lock allow GHSA-qw2m-4pqf-rmpp (fixed in 0.15.0) #100) andxclienttransaction>=1.0.3.0o600/0o700) for~/.twitter-clicaches and transaction caches..github/workflows/ci.yml(minimalcontents: read, concurrency cancel, job timeouts,ubuntu-24.04, Python 3.10–3.13 matrix).fix(graphql,tx): restore ClientTransaction bootstrap, refresh queryIds, fail-closed unsigned POSTs(a50aa90)x-client-transaction-idbootstrap against X's new strippedx-webshell: tries authenticatedhttps://x.com/homefirst, falls back to unauthenticatedhttps://x.com/i/jf/(live-verified 2026-11-27), and never leaks cookies to CDNondemand.s.*.jsfetches.FALLBACK_QUERY_IDS(includingUserByRestId,SearchTimeline,TweetDetail,CreateNoteTweet,Bookmarks, etc.), adds 24h owner-only disk cache (~/.twitter-cli/query_ids_cache.json),TWITTER_QID_<OP>env overrides, and updated JS bundle scanning (responsive-web/client-web,x-web/x-web,./assets/*.js)."Query: Unspecified"/PersistedQueryNotFounderrors and retries once after live lookup.POSTmutations unlessTWITTER_ALLOW_UNSIGNED=1is explicitly set; preferschrome136TLS impersonation.twrpatterns. Fixes error "HTTP 0: Query: Unspecified" for the for you feed #59, CLI always log warning Failed to init ClientTransaction #69, ClientTransaction init fails ('NoneType' object has no attribute 'group'), causing persistent 404s on search and account-verification endpoints despite built-in retry #73, twitter search returns HTTP 404 (SearchTimeline); ClientTransaction init fails with 'NoneType' object has no attribute 'group' #78, Search returns HTTP 404: x_client_transaction cannot parse new x-web homepage (no ondemand.s bundle) #88.feat(auth): support custom Chromium dirs, Vivaldi, Zen, TWITTER_COOKIE_STRING, and better diagnostics(d1125c6)TWITTER_CHROMIUM_USER_DATA_DIR(Cookies+Network/Cookies+Local Statekey_file), Vivaldi, and Zen browser cookie extraction (macOS/Linux/Flatpak/Windows).TWITTER_COOKIE_STRINGenv var for full browserCookie:headers (auto-extractsauth_token+ct0while preserving all session/anti-bot cookies — cleanly addresses headless/SigCLI/Windows workflows).feat(parser,model): rich tweet/user/media metadata, TweetDetail validation, article rich content, numeric user IDs(ed674be)followers/followingcounts and optionalviewerFollowing/viewerFollowedByflags (avoiding collision with integerfollowing).possiblySensitive, mediaadultContent/graphicViolence/otherWarning, plus optionalposterUrl/altText/durationMs.conversationId,inReplyToStatusId,inReplyToUserId,inReplyToScreenName) andtwitter tweet --cursorpagination.fetch_tweet_detail()(raisesNotFoundErrorinstead of empty success) and places the focal tweet first.UserByRestIdshape and routes all-digit user identifiers directly toUserByRestId.MARKDOWN,DIVIDER,TWEETatomic blocks, overlap-safe inline styles + links) and addstwitter bookmarks --cursor.twrpatterns. Fixes tweet detail returns success with empty data for real tweet IDs #53, Feature request: expose conversation_id / in_reply_to ids (and next cursor) in --json output #105.feat(cli,config): pagination cap, --time, shell completion, user config, news, and doctor(a9c098f)--maxbeyond defaultrateLimit.maxCountup to a 10,000 safety ceiling (fixes Pagination limited to 500 users despite X.com API supporting more #50).--time relative|absolute|iso(anddisplay.timein config) with clean UTF-8 output (fixing mojibake from fix: pagination cap (#50), --time (#35), completions (#36), actionable auth failures (#72/#28/#66) #104; fixes Add option to display absolute time #35).~/.twitter-cli/config.yamllookup between./config.yamland built-in defaults.twitter completion bash|zsh|fish(fixes Add shell completions for twitter CLI #36),twitter news(feat: add Explore News command #63, fixes Add "Today's News" Headlines #47), andtwitter doctor [--refresh](metadata-only, never prints secrets)._write_action().twrdoctor.feat(write): video upload, Premium long-form CreateNoteTweet, and article-publish(3ddca2d)tweet_video, MP4/MOV/WebM up to 512 MB, 4 MB chunks, asyncSTATUSpolling) and--video/-Vonpost,reply,quote(absorbs feat(media): video upload on post, reply, and quote #96, Add long-form post (CreateNoteTweet) + video upload support #62; fixes Feature request: support video media upload when posting #13).CreateNoteTweetrouting for long-form posts/quotes > 280 weighted chars (absorbs feat: support Premium long-form posts #64, feat: support long-form tweets via CreateNoteTweet #60; fixes support long text which is more than 300 characters #54).twitter article-publish <file.md> --title ... [--draft]converting Markdown to Draft.jscontent_state(absorbs feat: publish X Articles from Markdown #65).feat(api,docs): export Python library API and update README, SKILL.md, SCHEMA.md(2e07af9)TwitterClient,get_cookies,load_config,filter_tweets, models, exceptions, serializers) fromtwitter_cliwith import tests (fixes [feature] Extend your CLI tool as a Python library #9).README.md(English & Chinese),SKILL.md, andSCHEMA.md.Intentionally Deferred (Follow-up Candidates)
@aaajiao): Official Twitter API v2 OAuth2 backend (+2,736 lines, predates April/May refactors, requires an X Developer App to live-verify). Recommend evaluating as a separate PR/plugin.@Redwallen,[DRAFT]):twitter tweet --markdown— still marked draft with opinionated cwd file naming colliding with--output.Verification
uv run ruff check .— passeduv run mypy twitter_cli— passed (0issues across 20 source files)TERM=xterm uv run pytest -q— 338 passed, 8 integration tests deselectedcurl_cffi 0.17.0+xclienttransaction 1.0.3bootstrap againsthttps://x.com/i/jf/resolvesondemand.sand generates validx-client-transaction-id.Contributors (
Co-authored-by)Co-authored-by: axsddlr axsddlr@users.noreply.github.com
Co-authored-by: Canc luca.canc@gmail.com
Co-authored-by: Stoner stoner@StonerdeMacBook-Air.local
Co-authored-by: Lucius chenyh572@gmail.com
Co-authored-by: Jawad Margieh J.margieh@gmail.com
Co-authored-by: Kage oxkage@users.noreply.github.com
Co-authored-by: Ahmed Elshaabany ahmed.elshaabany@gmail.com
Co-authored-by: Perry Huang perry@gnuhpc.org
Co-authored-by: LiuWei liuweixh@gmail.com
Co-authored-by: Abdurrahman Özkan ozkanabdurrahmann@gmail.com
Co-authored-by: Blacksuite larszx@outlook.com
Co-authored-by: GodfreyPrince GodfreyPrince@users.noreply.github.com
Co-authored-by: Mckgare0717 mckinnonrebello@gmail.com
Co-authored-by: RiriAgent ririagent@users.noreply.github.com
Co-authored-by: Aditya Gupta adityagupta2087@gmail.com
Co-authored-by: edwinbernadus bernadus.edwin@gmail.com
Co-authored-by: Li Chenxi me@ayayaya.org
Co-authored-by: kangxl 230263957+zh-xl-kang@users.noreply.github.com
Co-authored-by: Ankit Ranjan arstejas7@gmail.com
Co-authored-by: jollyroger1480 jollyroger1480@users.noreply.github.com
Co-authored-by: rakei076 rakei076@users.noreply.github.com
Co-authored-by: hhh2210 hzy2210@gmail.com
Co-authored-by: Trần Quang Đãng 91641923+quangdang46@users.noreply.github.com