tt-help-cli-ycl 1.3.29 → 1.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/api-interceptor.js +11 -2
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { delay } from "./delay.js";
|
|
2
2
|
import { retryWithBackoff } from "./retry.js";
|
|
3
3
|
import { assertPageUrl } from "./browser/page.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
detectPageError,
|
|
6
|
+
detectPageErrorWithWait,
|
|
7
|
+
} from "./page-error-detector.js";
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* 处理 API 响应数据:提取首页视频 + 翻页
|
|
@@ -177,7 +180,13 @@ async function fetchUserVideosAPI(page, username, maxVideos, log) {
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
// API 已返回但没有视频时,优先判定是否是确定性的页面错误。
|
|
180
|
-
|
|
183
|
+
let pageError = await detectPageError(page);
|
|
184
|
+
|
|
185
|
+
// service_error 经常比 API 判定晚一点渲染,补一个短等待避免漏判“被封”。
|
|
186
|
+
if (!pageError) {
|
|
187
|
+
const delayedPageError = await detectPageErrorWithWait(page, 3000);
|
|
188
|
+
if (delayedPageError) pageError = delayedPageError;
|
|
189
|
+
}
|
|
181
190
|
|
|
182
191
|
if (pageError === "service_error") {
|
|
183
192
|
throw new Error(`被封: ${username}`);
|