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.
This commit is contained in:
@@ -27,26 +27,26 @@ TWITTER_OPENAPI_URL = (
|
||||
|
||||
# ── Fallback (hardcoded) queryIds ────────────────────────────────────────
|
||||
FALLBACK_QUERY_IDS = {
|
||||
"HomeTimeline": "L8Lb9oomccM012S7fQ-QKA",
|
||||
"HomeLatestTimeline": "tzmrSIWxyV4IRRh9nij6TQ",
|
||||
"UserByScreenName": "IGgvgiOx4QZndDHuD3x9TQ",
|
||||
"UserTweets": "O0epvwaQPUx-bT9YlqlL6w",
|
||||
"TweetDetail": "xIYgDwjboktoFeXe_fgacw",
|
||||
"Likes": "RozQdCp4CilQzrcuU0NY5w",
|
||||
"SearchTimeline": "rkp6b4vtR9u7v3naGoOzUQ",
|
||||
"Bookmarks": "uzboyXSHSJrR-mGJqep0TQ",
|
||||
"ListLatestTweetsTimeline": "fb_6wmHD2dk9D-xYXOQlgw",
|
||||
"Followers": "Enf9DNUZYiT037aersI5gg",
|
||||
"Following": "ntIPnH1WMBKW--4Tn1q71A",
|
||||
"CreateTweet": "zkcFc6F-RKRgWN8HUkJfZg",
|
||||
"DeleteTweet": "nxpZCY2K-I6QoFHAHeojFQ",
|
||||
"HomeTimeline": "c-CzHF1LboFilMpsx4ZCrQ",
|
||||
"HomeLatestTimeline": "BKB7oi212Fi7kQtCBGE4zA",
|
||||
"UserByScreenName": "1VOOyvKkiI3FMmkeDNxM9A",
|
||||
"UserTweets": "q6xj5bs0hapm9309hexA_g",
|
||||
"TweetDetail": "xd_EMdYvB9hfZsZ6Idri0w",
|
||||
"Likes": "lIDpu_NWL7_VhimGGt0o6A",
|
||||
"SearchTimeline": "VhUd6vHVmLBcw0uX-6jMLA",
|
||||
"Bookmarks": "2neUNDqrrFzbLui8yallcQ",
|
||||
"ListLatestTweetsTimeline": "RlZzktZY_9wJynoepm8ZsA",
|
||||
"Followers": "IOh4aS6UdGWGJUYTqliQ7Q",
|
||||
"Following": "zx6e-TLzRkeDO_a7p4b3JQ",
|
||||
"CreateTweet": "IID9x6WsdMnTlXnzXGq8ng",
|
||||
"DeleteTweet": "VaenaVgh5q5ih7kvyVjgtg",
|
||||
"FavoriteTweet": "lI07N6Otwv1PhnEgXILM7A",
|
||||
"UnfavoriteTweet": "ZYKSe-w7KEslx3JhSIk5LA",
|
||||
"CreateRetweet": "mbRO74GrOvSfRcJnlMapnQ",
|
||||
"DeleteRetweet": "ZyZigVsNiFO6v1dEks1eWg",
|
||||
"CreateRetweet": "ojPdsZsimiJrUGLR1sjUtA",
|
||||
"DeleteRetweet": "iQtK4dl5hBmXewYZuEOKVw",
|
||||
"CreateBookmark": "aoDbu3RHznuiSkQ9aNM67Q",
|
||||
"DeleteBookmark": "Wlmlj2-xzyS1GN3a6cj-mQ",
|
||||
"TweetResultByRestId": "zy39CwTyYhU-_0LP7dljjg",
|
||||
"TweetResultByRestId": "7xflPyRiUxGVbJd4uWmbfg",
|
||||
"BookmarkFoldersSlice": "i78YDd0Tza-dV4SYs58kRg",
|
||||
"BookmarkFolderTimeline": "hNY7X2xE2N7HVF6Qb_mu6w",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user