Commit Graph
100 Commits
Author SHA1 Message Date
dependabot[bot]andTony 417ab04f06 chore(deps-dev): bump eslint-plugin-unicorn from 66.0.0 to 68.0.0 (#22310)
* chore(deps-dev): bump eslint-plugin-unicorn from 66.0.0 to 68.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 66.0.0 to 68.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v66.0.0...v68.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 68.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* style: fix no-useless-coercion

* style: fix prefer-boolean-return

* style: fix no-useless-logical-operand

* style: fix prefer-single-replace

* style: fix consistent-conditional-object-spread

* style: fix no-useless-else

* style: fix prefer-unicode-code-point-escapes

* style: fix operator-assignment

* style: fix prefer-continue

* style: fix prefer-math-constants

* style: fix prefer-hoisting-branch-code

* style: fix prefer-array-slice

* style: fix consistent-class-member-order

* style: fix no-return-array-push

* style: fix prefer-promise-with-resolvers

* style: fix no-array-concat-in-loop

* style: fix no-loop-iterable-mutation

* style: fix no-invalid-argument-count

* style: fix no-duplicate-if-branches

* style: fix prefer-else-if

* style: fix no-unreadable-for-of-expression

* style: fix logical-assignment-operators

* style: fix default-export-style

* style: revert false positve in prefer-type-literal-last in #22274

* style: fix arrow-body-style

* style: add v68 recommended preset

* style: refactor GraphQL queries to use template literals for better readability

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tony <TonyRL@users.noreply.github.com>
2026-06-20 23:11:27 +08:00
github-actions[bot] 9f37d05ab6 style: auto format 2026-06-16 06:45:07 +00:00
dependabot[bot]andTony 873618e99d chore(deps-dev): bump eslint-plugin-unicorn from 65.0.1 to 66.0.0 (#22274)
* chore(deps-dev): bump eslint-plugin-unicorn from 65.0.1 to 66.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 65.0.1 to 66.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v65.0.1...v66.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 66.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* style: fix unicorn-js/prefer-url-href

* style: oxlint disable

* style: fix unicorn-js/no-useless-else

* style: no-unsafe-string-replacement

* style: fix no-duplicate-loops

* style: fix prefer-number-is-safe-integer

* style: fix prefer-single-array-predicate

* style: fix no-object-methods-with-collections

* style: fix no-useless-boolean-cast

* style: fix no-useless-template-literals

* style: fix no-negated-array-predicate

* style: fix prefer-direct-iteration

* style: fix consistent-optional-chaining

* style: fix prefer-simple-sort-comparator

* style: fix prefer-global-number-constants

* style: fix prefer-type-literal-last

* style: fix require-array-sort-compare.

* style: fix prefer-early-return

* style: fix prefer-short-arrow-method

* style: fix prefer-array-from-map

* style: fix prefer-scoped-selector

* style: fix no-global-object-property-assignment

* style: fix no-unnecessary-global-this

* style: fix no-unreadable-object-destructuring

* style: fix no-invalid-argument-count

* style: fix prefer-smaller-scope

* style: fix prefer-iterator-to-array.

* style: fix prefer-object-iterable-methods

* style: fix typo

* style: fix max-nested-calls

* style: fix no-incorrect-template-string-interpolation

* style: fix no-break-in-nested-loop

* style: fix prefer-await

* style: fix no-computed-property-existence-check

* style: fix prefer-number-coercion

* style: fix no-empty-file

* style: update eslint unicorn v66 recommended preset

* style: add unicorn/prefer-spread to oxlint-disable comments

* style: fix no-array-reduce

* style: delete github/no-then as it's covered by unicorn/prefer-await

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tony <TonyRL@users.noreply.github.com>
2026-06-16 14:43:42 +08:00
Tony cfcdc34e1f refactor: replace playwright with patchright (#21976)
* refactor: use patchwright

* refactor: migrate setRequestInterception and waitUntil

* fix: overwrite ua

* refactor: drop puppeteer cookie/requestfinished shims

Migrate page.cookies/setCookie and browser.cookies/setCookie call sites to the native context APIs (page.context().cookies/addCookies), rewrite requestfinished handlers to await request.response() instead of consuming the synchronous puppeteer-shaped payload, and remove the now-redundant browser.close context-cleanup wrapper. Playwright already handles all of these natively; the shims existed only for the puppeteer -> playwright migration.

* refactor: remove page.authenticate, page.setUserAgent,  browser.newPage(), browser.userAgent() shims

update cookie utility tests

* refactor: replace browser instance with context in Playwright usage across multiple routes

- Updated all instances of `browser` to `context` in Playwright-related functions for consistency and improved resource management.
- Ensured proper closure of context after operations to prevent memory leaks.
- Adjusted request interception methods to utilize the new context variable.

* fix: direct type import

* refactor: remove Puppeteer compatibility layers and unify page handling with Playwright

* fix: test case

* chore: bump patchright to v1.60.0

* chore: pin patchright to 1.59.1

nft can't resolve browser.json due to https://github.com/microsoft/playwright/pull/40093

* chore: pin to node 24.15 for playwright

browser install on node 24.16 stucks due to https://github.com/microsoft/playwright/issues/40724

* fix: update patchright and patchright-core to version 1.60.2 and adjust minify-docker.js for compatibility

* fix: import BrowserContext from patchright
2026-06-07 02:43:20 +08:00
Tony 75d43dd086 chore: add eslint-plugin-regexp (#22189)
* chore: add eslint-plugin-regexp

* chore: autofix

* chore: fix no-useless-flag

* chore: fix optimal-lookaround-quantifier

* chore: fix no-lazy-ends

* chore: fix no-contradiction-with-assertion

* chore: fix no-useless-assertions

* chore: fix no-useless-quantifier

* chore: fix remaining regexp issues

* fix: regex for WFU news link validation
2026-06-05 20:04:39 +08:00
Tony fbe1a46018 fix(route/twitter): throw exception on invalid user 2026-06-04 05:25:46 +08:00
Jsongcloudandroot db1e74c6f9 fix(route/twitter): handle TweetPreviewDisplay for subscriber-only posts (#21957)
* fix(twitter): handle TweetPreviewDisplay for subscriber-only posts

* fix(twitter): remove unused screenName variable

* fix(twitter): fix indentation and use English comments

* fix(twitter): fix indentation and remove unused variables

* fix(twitter): revert mobile-api changes as mobile API is disabled

* fix(twitter): add configurable prefix options for subscriber-only posts

---------

Co-authored-by: root <root@exquisite-echo-2.localdomain>
2026-05-30 11:37:37 +08:00
DIYgod 566f028aaf refactor: migrate browser automation to Playwright (#21901)
* refactor: migrate browser automation to Playwright

* ci: update browser checks for Playwright
2026-05-04 21:16:18 +08:00
DIYgod 7a7453d2d2 fix(twitter): handle unavailable quoted tweets 2026-04-28 21:09:55 +08:00
github-actions[bot] ebfe021b50 style: auto format 2026-04-14 15:15:05 +00:00
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
dependabot[bot]andTony 12eece429c chore(deps): bump otplib from 12.0.1 to 13.0.2 (#20855)
* chore(deps): bump otplib from 12.0.1 to 13.0.2

Bumps [otplib](https://github.com/yeojz/otplib/tree/HEAD/packages/otplib) from 12.0.1 to 13.0.2.
- [Release notes](https://github.com/yeojz/otplib/releases)
- [Commits](https://github.com/yeojz/otplib/commits/v13.0.2/packages/otplib)

---
updated-dependencies:
- dependency-name: otplib
  dependency-version: 13.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: migrate to otplib v13

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tony <TonyRL@users.noreply.github.com>
2026-01-12 23:49:56 +08:00
DIYgod 7f5ae64a2f feat(twitter): add UserMedia support and enhance pagination logic 2025-12-01 22:57:09 +08:00
github-actions[bot] a28890a135 style: auto format 2025-11-27 02:55:46 +00:00
DIYgod 92032a8c51 fix(twitter): update proxy agent implementation to use new Client and HttpCookieAgentCookie 2025-11-15 09:37:48 +08:00
DIYgod d03f5697a4 fix(twitter): replace zstd decompression with gzip for third-party API requests 2025-11-15 09:01:46 +08:00
Tony daf9460e6a fix(router/twitter): replace zstd decoder with native zlib decompression (#20485)
* fix(twitter): replace zstd decoder with native zlib decompression

* fix(twitter): update node version compatibility and enable experimental features
2025-11-15 01:56:23 +08:00
DIYgod a07565d356 feat(api): implement zstd decoding for third-party API responses 2025-11-14 14:13:18 +08:00
DIYgod 12a519ff83 fix: twitter data 2025-09-25 11:38:11 +08:00
Tony 857d5989c1 feat(utils/puppeteer): replace puppeteer-extra-plugin-stealth with rebrowser (#19506)
* feat: use rebrowser

* fix: remove rebrowser-puppeteer-core

* fix: chrome not found

* fix: replace remove-infobar with disable-blink-features

remove-infobar was removed since M76 https://github.com/puppeteer/puppeteer/issues/1765

* feat: remove outdated stealth plugin

* fix: remove puppeteer non stealth test
2025-07-01 04:38:05 +08:00
Neko AriaandNekoAria d6ea75914f fix(route/twitter): handle timeline_v2 nested structure (#19428)
Co-authored-by: NekoAria <NekoAria@users.noreply.github.com>
2025-06-23 01:18:01 +08:00
pseudoyu 7807467377 fix(route/twitter): extract name and screen_name from core field 2025-06-18 15:48:01 +08:00
pseudoyu 5048710a37 refactor(route/twitter): support both timeline and timeline_v2 in twitter web api 2025-06-18 09:58:54 +08:00
pseudoyu aaac8a2626 fix(route/twitter): twitter graphql resp data struct 2025-06-18 09:52:31 +08:00
AiraNadihandAiraNadih 89fe12969f refactor(twitter): reduce token lock time from 24h to 1h (close #17580) (#19274)
Co-authored-by: AiraNadih <AiraNadih@users.noreply.github.com>
2025-06-04 22:45:53 +08:00
pseudoyu fcd4b8f8f6 feat(route/twitter): support third-party twitter keywords api 2024-12-17 00:37:29 +08:00
pseudoyu 6deb2f57cf feat(route/twitter): support twitter list third-party api 2024-12-12 13:53:50 +08:00
pseudoyu 844e658008 feat(route/twitter): only apply third-party api supported routes 2024-12-10 11:29:59 +08:00
pseudoyu 60dd8f6ba6 feat(route/twitter): support getUserTweets thirdparty api 2024-12-06 16:12:32 +08:00
pseudoyu 3e102d5a53 refactor(route/twitter): keep twitter graphql endpoints consistent 2024-11-29 14:18:20 +08:00
pseudoyu 3f12f922bf feat(route/twitter): add third-party twitter api support 2024-11-29 13:50:59 +08:00
lifegpc 4b6658605a fix(twitter)!: 修复Twitter 长文本显示不全 (#17596)
* Try fix

* apply fix for mobile api
2024-11-15 23:48:09 +08:00
Gnosnay a8ae1e1567 fix(twitter): await set cookie (#17545) 2024-11-12 02:34:23 +08:00
DIYgod 3ea381e7db feat(twitter): debug 2024-11-09 02:01:24 +08:00
Gnosnay fd5a888f18 fix(route/twitter): await when get cache (#17429) 2024-11-03 22:18:10 +08:00
DIYgod 0c506b84c8 feat(twitter): double lock time 2024-11-03 22:15:46 +08:00
DIYgod a9d2ea5b04 feat(twitter): recover cookie updating 2024-11-03 21:45:55 +08:00
DIYgod 70435d4ae1 feat(twitter): debug 2024-11-03 21:28:21 +08:00
Andvari 2eef201d16 fix(route/twitter): Prevent storing empty cookie if obtaining such from auth_token failed. (#17232) 2024-10-31 23:56:54 +08:00
DIYgod 682c9439b7 fix(twitter): disable cookie updating 2024-10-31 22:42:48 +08:00
Otstar Lin 78bf6daf6c fix(route/twitter): Mask the error output to avoid leak token (#17193) 2024-10-19 14:03:37 +08:00
DIYgod bf2e71ce80 fix(twitter): cache unlock 2024-10-15 20:11:41 +08:00
DIYgod 2de569b4d2 feat(twitter): limit remainingInt to 2 2024-10-15 16:41:55 +08:00
DIYgod 77bf780b95 fix(twitter): lock ceil 2024-10-07 02:08:31 +08:00
DIYgod 9b144a715f fix(twitter): debug 2024-10-07 01:50:26 +08:00
DIYgod 6f6373932d fix(twitter): gt cookie 2024-10-07 00:26:09 +08:00
DIYgod a2ca21a11b feat(twitter): allowNoAuth for UserByScreenName api 2024-10-06 23:23:17 +08:00
DIYgod c4102fa072 feat(twitter): handle response headers rate limit 2024-10-06 23:10:03 +08:00
DIYgod bac798ae97 feat(twitter): try catch allow empty content 2024-10-06 20:30:31 +08:00
DIYgod 19ea5ccc98 feat(twitter): 429 debug 2024-10-06 19:30:37 +08:00