添加动图支持,优化图片和视频上传逻辑,调整超时设置,增强评论时间格式化
This commit is contained in:
@@ -84,11 +84,11 @@ export async function scrapeDouyin(url: string) {
|
||||
const firstTypePromise = waitForFirstResponse(context, [
|
||||
{ key: 'detail', test: (r: Response) => r.url().includes(DETAIL_PATH) && r.status() === 200 },
|
||||
{ key: 'post', test: (r: Response) => r.url().includes(POST_PATH) && r.status() === 200 },
|
||||
], 9_000); // 整体 9s 兜底超时,不逐个等待
|
||||
], 40_000);
|
||||
|
||||
// 评论只做短时“有就用、没有不等”的监听
|
||||
const commentPromise = waitForResponseWithTimeout(
|
||||
context, (r: Response) => r.url().includes(COMMENT_PATH) && r.status() === 200, 8_000
|
||||
context, (r: Response) => r.url().includes(COMMENT_PATH) && r.status() === 200, 40_000
|
||||
).catch(() => null);
|
||||
|
||||
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
||||
|
||||
Reference in New Issue
Block a user