Commit Graph

11 Commits

Author SHA1 Message Date
nemo
1f3a9ee535 fix: adapt to Twitter API schema changes (April 2026) (#51)
- Migrate user profile fields from `legacy{}` to `core{}` / `avatar{}` / `location{}` (with legacy fallback for older response shapes). Affects `user`, `whoami`, `status`, `followers`, `following`.
- Fix `user-posts` empty results: add missing `includePromotedContent` variable and update `instructions` path from `timeline_v2` to `timeline`.
- Switch `followers` / `following` to POST (Twitter changed the requirement).
- Refresh 16 stale `FALLBACK_QUERY_IDS` from fa0311/twitter-openapi.
- Drop `legacy{}` early-return in `parse_user_result`; key existence on `rest_id` so followers/following keep working when Twitter fully drops legacy.
- Add unit tests for the new core/avatar/location fallback chain and rest_id/typename guards.
2026-04-29 21:20:39 +08:00
Lucius
7816f8d813 Feed cursor pagination (#49)
* Expose promoted tweets in feed output

* Add cursor-based feed pagination output
2026-04-10 01:20:18 +08:00
jackwener
b752c31dfd improve: add early return, escape markdown brackets in labels and parentheses in URLs
- Early return when no entityRanges (skip unnecessary processing)
- Escape [ and ] in link labels to prevent nested bracket issues
- Encode ) in URLs as %29 to prevent malformed markdown links (e.g. Wikipedia)
- Add 3 new test cases for the above edge cases
2026-03-21 17:48:02 +08:00
alextuan1024
c63b5a2ede fix(article): preserve inline hyperlinks in markdown export 2026-03-21 13:34:35 +08:00
jakevin
ad40848c18 feat: render article inline images as markdown (#38)
* feat: render article inline images as markdown

* fix: support list-style article entity maps

* test: add real-world article image fixtures

* fix: preserve article markdown blocks with inline images

Co-authored-by: alextuan1024 <alextuan1024@gmail.com>

---------

Co-authored-by: alextuan1024 <alextuan1024@gmail.com>
2026-03-17 18:13:52 +08:00
jackwener
fb1a9b1564 review: preserve subscriber-only flag for retweets 2026-03-17 18:10:04 +08:00
Tao BAI
66115a4837 feat: detect subscriber-only tweets via tweetInterstitial (#33)
Extract visibility metadata from TweetWithVisibilityResults wrapper
before unwrapping. Adds is_subscriber_only field to Tweet model,
with full serialization roundtrip and test coverage.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 18:09:15 +08:00
alextuan1024
90f0635c50 feat: preserve article atomic markdown blocks (#37)
* fix: preserve atomic markdown blocks in articles

* test: add parser unit coverage for article markdown blocks
2026-03-17 18:06:02 +08:00
jackwener
ce4326ef42 fix: extract full text from note_tweet for long tweets (fixes #20)
Twitter long tweets (>280 chars) store full text in
note_tweet.note_tweet_results.result.text rather than legacy.full_text.
The parser now prioritizes note_tweet text when available.
2026-03-14 13:45:10 +08:00
jackwener
7d1b519c85 fix: harden search validation and release v0.7.1 2026-03-13 01:04:29 +08:00
jackwener
c2b9be4669 refactor: split client.py into graphql.py + parser.py modules
Split the monolithic client.py (1341 lines) into three focused modules:

- graphql.py (~200 lines): queryId resolution, URL building, JS bundle
  scanning, feature flag management
- parser.py (~270 lines): Tweet/User/Media/Article parsing, utility functions
  (_deep_get, _parse_int, _extract_cursor, _extract_media)
- client.py (~700 lines): TwitterClient class with HTTP engine, anti-detection,
  session management, and all public API methods

Backward compatibility: client.py re-exports all previously public symbols
so existing test imports work without modification. 88/88 tests pass.
2026-03-10 23:18:59 +08:00