mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add more error handling
This commit is contained in:
parent
3526053faf
commit
8a8e165908
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bilibili-evolved-video-link-downloader",
|
||||
"version": "1.7.28.0",
|
||||
"version": "1.7.28.1",
|
||||
"description": "Bilibili Evolved 视频链接下载器",
|
||||
"main": "video-link-downloader.js",
|
||||
"bin": {
|
||||
@ -36,4 +36,4 @@
|
||||
"url": "https://github.com/the1812/Bilibili-Evolved/issues"
|
||||
},
|
||||
"homepage": "https://github.com/the1812/Bilibili-Evolved/"
|
||||
}
|
||||
}
|
||||
@ -71,10 +71,10 @@ class Downloader {
|
||||
this.progressMap.set(req, this.progressMap.get(req) + data.length);
|
||||
this.updateProgress();
|
||||
}).on("error", error => {
|
||||
this.progressMap.set(req, 0);
|
||||
this.progressMap.delete(req);
|
||||
this.progressMap.set(makeRequest(), 0);
|
||||
this.updateProgress();
|
||||
// makeRequest();
|
||||
console.error(error);
|
||||
console.error(`片段下载失败: ${error} 重试中...`);
|
||||
});
|
||||
req.pipe(fs.createWriteStream(`${title}.part${part}`));
|
||||
return req;
|
||||
@ -132,7 +132,7 @@ class Downloader {
|
||||
inputData = JSON.parse(jsonText);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`未在剪贴板检测到有效数据, 也没有指定输入文件.`);
|
||||
console.log(`[无数据] 未在剪贴板检测到有效数据/没有指定输入文件/输入文件的数据无效.`);
|
||||
process.exit();
|
||||
}
|
||||
try {
|
||||
|
||||
@ -99,10 +99,10 @@ class Downloader
|
||||
this.updateProgress();
|
||||
}).on("error", error =>
|
||||
{
|
||||
this.progressMap.set(req, 0);
|
||||
this.progressMap.delete(req);
|
||||
this.progressMap.set(makeRequest(), 0);
|
||||
this.updateProgress();
|
||||
// makeRequest();
|
||||
console.error(error);
|
||||
console.error(`片段下载失败: ${error} 重试中...`);
|
||||
});
|
||||
req.pipe(fs.createWriteStream(`${title}.part${part}`));
|
||||
return req;
|
||||
@ -173,7 +173,7 @@ class Downloader
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
console.log(`未在剪贴板检测到有效数据, 也没有指定输入文件.`);
|
||||
console.log(`[无数据] 未在剪贴板检测到有效数据/没有指定输入文件/输入文件的数据无效.`);
|
||||
process.exit();
|
||||
}
|
||||
try
|
||||
|
||||
Loading…
Reference in New Issue
Block a user