RSSHub/lib
Guorui Yu d8eaee5889
fix(route/twitter): dynamically resolve GraphQL query IDs and fix production CookieAgent (#21544)
* fix(route/twitter): dynamically resolve GraphQL query IDs from Twitter JS bundles

Twitter rotates GraphQL query IDs every 2-4 weeks, causing 404 errors.
Instead of relying solely on hardcoded IDs, fetch and cache the latest
query IDs from Twitter's client-web main.js bundle at runtime.

- Add gql-id-resolver module to extract queryId/operationName pairs
- Cache resolved IDs using CACHE_CONTENT_EXPIRE (Redis supported)
- Fall back to hardcoded IDs if dynamic resolution fails
- Update init() to trigger resolution before first API call

Signed-off-by: yuguorui <yuguorui@pku.edu.cn>

* fix(route/twitter): use undici.fetch directly to preserve CookieAgent dispatcher

Both ofetch and the global wrappedFetch (request-rewriter) drop the
dispatcher option when constructing a new Request object, which prevents
the CookieAgent from attaching cookies in production builds. Use
undici.fetch directly for Twitter API requests to preserve the dispatcher.

Signed-off-by: yuguorui <yuguorui@pku.edu.cn>

---------

Signed-off-by: yuguorui <yuguorui@pku.edu.cn>
2026-04-06 22:46:29 +08:00
..
api feat(api): add cache probing (#21300) 2026-03-05 02:36:53 +08:00
assets
errors feat(core): add honeybadger support (#21574) 2026-04-01 01:10:12 +08:00
middleware feat(core): add honeybadger support (#21574) 2026-04-01 01:10:12 +08:00
routes fix(route/twitter): dynamically resolve GraphQL query IDs and fix production CookieAgent (#21544) 2026-04-06 22:46:29 +08:00
routes-deprecated
shims chore(deps-dev): bump the oxc group across 1 directory with 4 updates (#21583) 2026-04-01 22:10:13 +08:00
utils fix(route/dailypush): use puppeteer (#21160) 2026-04-04 05:00:09 +08:00
views feat: add promotion 2026-03-17 15:59:10 +08:00
app-bootstrap.test.tsx feat(core): add honeybadger support (#21574) 2026-04-01 01:10:12 +08:00
app-bootstrap.tsx feat(core): add honeybadger support (#21574) 2026-04-01 01:10:12 +08:00
app.test.ts fix(ua): ensure header-generator and custom ua are effective with each other (#21546) 2026-03-29 22:47:56 +08:00
app.ts chore: unpin jsdom (#21505) 2026-03-25 23:16:40 +08:00
app.worker.tsx feat(core): add honeybadger support (#21574) 2026-04-01 01:10:12 +08:00
config.remote-error.test.ts
config.test.ts fix(ua): ensure header-generator and custom ua are effective with each other (#21546) 2026-03-29 22:47:56 +08:00
config.ts feat(core): add honeybadger support (#21574) 2026-04-01 01:10:12 +08:00
container.ts
entrypoints.test.ts
index.test.ts
index.ts
pkg.test.ts
pkg.ts
registry.dynamic.test.ts feat: esm directory import (#21428) 2026-03-18 15:15:28 +08:00
registry.test.ts
registry.ts feat: esm directory import (#21428) 2026-03-18 15:15:28 +08:00
route-paths.d.ts
router.js
routes.test.ts
server.ts
setup.test.ts chore(deps-dev): bump msw from 2.4.3 to 2.12.14 (#21483) 2026-03-25 02:31:42 +08:00
types.ts
worker.ts
worker.worker.test.ts