Commit Graph

19 Commits

Author SHA1 Message Date
jackwener
5c1015f1fd fix: handle changed /account/multi/list.json response format
Twitter changed the response format from a list with nested 'user'
objects to {"users": [{user_id, name, screen_name, ...}]} with
minimal fields. Now extracts screen_name from the new format and
fetches the full profile via GraphQL UserByScreenName endpoint.
2026-03-11 00:40:07 +08:00
jackwener
9cf74abd56 feat: add integration smoke tests
CLI-level smoke tests using --yaml output against real Twitter API.
Default skipped via @pytest.mark.smoke marker + pyproject.toml addopts.
Run locally with: uv run pytest -m smoke -v
2026-03-10 22:26:46 +08:00
jackwener
7fb02ba18c feat: cookie file cache with TTL + user --json
- Cookie cache: save to ~/.cache/twitter-cli/cookies.json (24h TTL)
- On 401/403 auth failure: auto-invalidate cache, re-extract from browser
- Cache uses 0600 permissions for security
- Add --json option to twitter user command for scripting
- Priority: env vars → cache file → browser extraction
2026-03-09 21:47:23 +08:00
jackwener
bbe0bc8de3 docs: rename rt/unrt → retweet/unretweet, update SKILL.md + README.md
- Rename rt/unrt commands to retweet/unretweet for clarity
- SKILL.md: fix Python version, add --output/--filter examples, safety notes
- README.md: dynamic Chrome fingerprint, write delays, --output examples
- Sync Chinese section with English changes
2026-03-09 21:20:05 +08:00
jackwener
8313a7012f refactor: dynamic UA matching, session reuse, score Optional, --output on all commands
- constants.py: sync_chrome_version() aligns UA/sec-ch-ua with impersonate target
- auth.py: reuse shared cffi session instead of creating duplicate
- filter.py: eliminate double weight building in score_tweet
- models.py: Tweet.score → Optional[float] for accurate display
- cli.py: add --output to search/likes/user-posts for consistency
2026-03-09 21:15:28 +08:00
jackwener
fda9b1c3dc fix: 431 Request Too Large — reduce FEATURES to 15 essential keys, dynamic update only updates existing keys 2026-03-09 20:59:16 +08:00
jackwener
d20c5699fd fix: 414 URI Too Long — omit False-valued features from GET URL, add regression tests 2026-03-09 20:50:45 +08:00
jackwener
12f425abea feat: write operation delays, dynamic FEATURES update, 30+ client.py tests, fix README proxy wording 2026-03-09 20:45:51 +08:00
jackwener
b9c226b804 fix: dynamic Chrome impersonation + in-process macOS Keychain cookie extraction (closes #4) 2026-03-09 20:38:47 +08:00
jackwener
59b5df7f71 fix: ClawHub publish (acceptLicenseTerms), add LICENSE, fix score display bug, remove unused var 2026-03-09 20:32:45 +08:00
jackwener
94e21fba9a fix: remove unused requests import (CI lint), fix README wording, drop requests dep 2026-03-09 20:25:24 +08:00
jackwener
a6ad246071 fix: improve error handling for write operation rate limits (retweet/like) 2026-03-09 20:22:46 +08:00
jackwener
731151e62e fix: use curl_cffi for ClientTransaction init to prevent TLS fingerprint leak 2026-03-09 19:14:33 +08:00
jackwener
b83abadb73 feat: full cookie forwarding from browser and TWITTER_PROXY support 2026-03-09 19:12:06 +08:00
jackwener
27d73efee5 feat: anti-detection hardening with curl_cffi TLS impersonation and request jitter 2026-03-09 17:11:59 +08:00
jackwener
d2d971c865 refactor: deep review fixes round 3
- client.py:
  - Remove dead _extract_cursor second branch (unreachable code)
  - Cache SSL context as module-level _SSL_CTX (avoid re-reading CA certs)
  - Add 404 stale-fallback retry to _graphql_post (parity with GET)
  - Remove dead core.get('name')/core.get('screen_name') in fetch_user
  - Set Content-Type: application/json only for POST requests
  - Rename _to_int → _parse_int for clarity vs config._as_int
  - Add 'not thread-safe' note on module-level caches

- cli.py:
  - _fetch_and_display now accepts optional config param (fix double load)
  - Refactor user_posts to use _fetch_and_display
  - Pass config to all _fetch_and_display callers

- pyproject.toml:
  - Move xclienttransaction/requests to optional [transaction] deps
  - Add beautifulsoup4 to [transaction] optional deps

- README.md:
  - Add rateLimit config section with comments
  - Add constants.py to project structure tree
2026-03-08 13:58:06 +08:00
jackwener
767a466667 fix: add x-client-transaction-id header for search API
- Root cause: Twitter's SearchTimeline endpoint requires x-client-transaction-id
  header that HomeTimeline/Bookmarks don't enforce
- Integrate XClientTransaction library for header generation
- Add requests + beautifulsoup4 dependencies
- Fix SearchTimeline variables (override base timeline vars)
- Update FEATURES dict and fallback queryIds to match live x.com values
2026-03-07 19:53:55 +08:00
jackwener
4c08d09304 refactor: harden CLI/client/config and centralize serialization 2026-03-05 16:13:54 +08:00
jackwener
16752c3115 Initial commit: twitter-cli v0.1.0 2026-03-04 17:56:42 +08:00