mirror of
https://github.com/Tusko/vimeo-private-downloader.git
synced 2025-08-21 05:44:04 -07:00
fix: put timeout check in the right location
This commit is contained in:
parent
12d86dfda7
commit
7dc3f70762
1 changed files with 7 additions and 7 deletions
|
@ -107,7 +107,7 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
|||
`Downloading ${type} segment ${i}/${segmentsUrl.length} of ${filename}`
|
||||
);
|
||||
|
||||
https
|
||||
let req = https
|
||||
.get(segmentsUrl[i], res => {
|
||||
res.on("data", d => output.write(d));
|
||||
|
||||
|
@ -118,12 +118,17 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
|||
.on("error", e => {
|
||||
cb(e);
|
||||
});
|
||||
|
||||
req.setTimeout(7000, function () {
|
||||
log("⚠️", 'Timeout. Retrying');
|
||||
combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag, cb);
|
||||
});
|
||||
}
|
||||
|
||||
function getJson(url, cb) {
|
||||
let data = "";
|
||||
|
||||
let req = https
|
||||
https
|
||||
.get(url, res => {
|
||||
res.on("data", d => (data += d));
|
||||
|
||||
|
@ -132,11 +137,6 @@ function getJson(url, cb) {
|
|||
.on("error", e => {
|
||||
cb(e);
|
||||
});
|
||||
|
||||
req.setTimeout(7000, function () {
|
||||
log("⚠️", 'Timeout. Retrying');
|
||||
combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag, cb);
|
||||
});
|
||||
}
|
||||
|
||||
function initJs(n = 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue