mirror of
https://github.com/Tusko/vimeo-private-downloader.git
synced 2025-08-20 21:34:03 -07:00
feat: Better error handling on segment-url extraction
This commit is contained in:
parent
b8fe708f77
commit
8cfdb466d5
1 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
@ -86,7 +86,12 @@ function processFile(type, baseUrl, initData, segments, filename, cb) {
|
||||||
fs.writeFileSync(downloadingFlag, '');
|
fs.writeFileSync(downloadingFlag, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
const segmentsUrl = segments.map(seg => baseUrl + seg.url);
|
const segmentsUrl = segments.map(seg => {
|
||||||
|
if (!seg.url) {
|
||||||
|
throw new Error(`found a segment with an empty url: ${JSON.stringify(seg)}`);
|
||||||
|
}
|
||||||
|
return baseUrl + seg.url;
|
||||||
|
});
|
||||||
|
|
||||||
const initBuffer = Buffer.from(initData, "base64");
|
const initBuffer = Buffer.from(initData, "base64");
|
||||||
fs.writeFileSync(filePath, initBuffer);
|
fs.writeFileSync(filePath, initBuffer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue