You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
async function main() {
|
|
|
|
|
// 爬取第1页到第10页的视频BV号
|
|
|
|
|
for (let i = 1; i <= 10; i++) {
|
|
|
|
|
await getBv(i);
|
|
|
|
|
}
|
|
|
|
|
console.log("BV列表长度:", bvList.length);
|
|
|
|
|
|
|
|
|
|
// 将BV号写入本地文件
|
|
|
|
|
fs.writeFileSync('bv.txt', bvList.join('\n'), 'utf-8');
|
|
|
|
|
|
|
|
|
|
// 对于每个BV号,爬取CID号
|
|
|
|
|
bvList.forEach(bv => {
|
|
|
|
|
getCid(bv);
|
|
|
|
|
});
|
|
|
|
|
console.log("CID列表长度:", cidList.length);
|
|
|
|
|
|
|
|
|
|
// 将CID号写入本地文件
|
|
|
|
|
fs.writeFileSync('cid.txt', cidList.join('\n'), 'utf-8');
|
|
|
|
|
|
|
|
|
|
// 对于每个
|
|
|
|
|
|
|
|
|
|
CID号,爬取弹幕内容
|
|
|
|
|
cidList.forEach(cid => {
|
|
|
|
|
getChat(cid);
|
|
|
|
|
});
|
|
|
|
|
console.log("弹幕内容列表长度:", chatList.length);
|
|
|
|
|
|
|
|
|
|
// 将弹幕内容写入本地文件
|
|
|
|
|
fs.writeFileSync('chat.txt', chatList.join('\n'), 'utf-8');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main();
|