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.

35 lines
842 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

```javascript
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();
```