comment 打印 current_time
This commit is contained in:
parent
8e0406a485
commit
f22a9c5228
@ -64,7 +64,7 @@ async function fetch({ songId, debug = false }) {
|
|||||||
let isFinish = false; let pageCount = 0;
|
let isFinish = false; let pageCount = 0;
|
||||||
while (!isFinish) {
|
while (!isFinish) {
|
||||||
await global.checkIsExit();
|
await global.checkIsExit();
|
||||||
console.log(`comment: ${songId}, page: ${++pageCount}`);
|
console.log(`comment: ${songId}, page: ${++pageCount}, currentTime: ${progress.currentTime}`);
|
||||||
|
|
||||||
// 是否是第一页
|
// 是否是第一页
|
||||||
let isFirstPage = progress.currentStatus === 0;
|
let isFirstPage = progress.currentStatus === 0;
|
||||||
@ -74,8 +74,8 @@ async function fetch({ songId, debug = false }) {
|
|||||||
var commentResult = await comment_music(queryParams);
|
var commentResult = await comment_music(queryParams);
|
||||||
// fs.writeFileSync(path.join(__dirname, "../../temp", `comment-${songId}-${pageCount}.json`), JSON.stringify(commentResult));
|
// fs.writeFileSync(path.join(__dirname, "../../temp", `comment-${songId}-${pageCount}.json`), JSON.stringify(commentResult));
|
||||||
} catch (errors) {
|
} catch (errors) {
|
||||||
console.error(errors);
|
console.error("error", errors);
|
||||||
await sleepUtils.sleep(1000);
|
await sleepUtils.sleep(3000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ async function fetch({ songId, debug = false }) {
|
|||||||
progress.total = commentResult.body.total;
|
progress.total = commentResult.body.total;
|
||||||
} else {
|
} else {
|
||||||
isFinish = true;
|
isFinish = true;
|
||||||
console.log(`comment: ${songId} 结束了`);
|
console.log(`comment: ${songId} done`);
|
||||||
progress.currentStatus = 2; // 0-等待爬取/增量爬取 1-爬取中 2-完成
|
progress.currentStatus = 2; // 0-等待爬取/增量爬取 1-爬取中 2-完成
|
||||||
if (progress.maxTime == 0) { // 第一次爬取 且 没有分页的情况
|
if (progress.maxTime == 0) { // 第一次爬取 且 没有分页的情况
|
||||||
progress.maxTime = comments[0] ? (comments[0].time || 0) : 0;
|
progress.maxTime = comments[0] ? (comments[0].time || 0) : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user