mirror of
https://github.com/Tusko/vimeo-private-downloader.git
synced 2025-08-20 21:34:03 -07:00
fix expired links
This commit is contained in:
parent
c103351cc2
commit
b662f20d4b
2 changed files with 20 additions and 24 deletions
15
videojson.js
15
videojson.js
|
@ -1,19 +1,14 @@
|
||||||
const list = [
|
const list = [
|
||||||
|
{
|
||||||
|
name: "Beluga test",
|
||||||
|
url:
|
||||||
|
"https://33vod-adaptive.akamaized.net/exp=1612606615~acl=%2F84112832%2F%2A~hmac=e59eb3562ab8f318d99ffa8b9047fc13471414ae6a2fbb91d31963e640f8a7ff/84112832/sep/video/219068532,219068533/master.json?base64_init=1"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "1. Introduction",
|
name: "1. Introduction",
|
||||||
url:
|
url:
|
||||||
"https://60vod-adaptive.akamaized.net/exp=1585642273~acl=%2F290272859%2F%2A~hmac=83af394043c1f9e24e0b1ffdd22e771c0ef2106a6a6ce4cf5e6a288dba76ceef/290272859/sep/video/1099558424,1099558420,1099557256,1099557251/master.json?base64_init=1"
|
"https://60vod-adaptive.akamaized.net/exp=1585642273~acl=%2F290272859%2F%2A~hmac=83af394043c1f9e24e0b1ffdd22e771c0ef2106a6a6ce4cf5e6a288dba76ceef/290272859/sep/video/1099558424,1099558420,1099557256,1099557251/master.json?base64_init=1"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "2.1. Интро",
|
|
||||||
url:
|
|
||||||
"https://117vod-adaptive.akamaized.net/exp=1585640053~acl=%2F207987916%2F%2A~hmac=9834e76445d49081a3b04c7e40f656ec256a04e1f53e7e7594d228a117f27ac0/207987916/sep/video/710158253,710158251,710158247,710158246/master.json?base64_init=1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "2.2. Mindset",
|
|
||||||
url:
|
|
||||||
"https://120vod-adaptive.akamaized.net/exp=1585640068~acl=%2F207987919%2F%2A~hmac=b7e36ce71b8b679653141a51acbd5d8f7ca49d6c687704ad14d7c195f441dc80/207987919/sep/video/710158304,710158302,710158298,710158294/master.json?base64_init=1"
|
|
||||||
},
|
|
||||||
// {
|
// {
|
||||||
// name: '2.3. Точка А и точка В',
|
// name: '2.3. Точка А и точка В',
|
||||||
// url: 'https://122vod-adaptive.akamaized.net/exp=1581672008~acl=%2F207987921%2F%2A~hmac=b444cacf99794d91a4b6b4d9df1e3e5b262980920ff21e809b7fe8f939fec49a/207987921/sep/video/710158242,710158240,710158238,710158235/master.json?base64_init=1'
|
// url: 'https://122vod-adaptive.akamaized.net/exp=1581672008~acl=%2F207987921%2F%2A~hmac=b444cacf99794d91a4b6b4d9df1e3e5b262980920ff21e809b7fe8f939fec49a/207987921/sep/video/710158242,710158240,710158238,710158235/master.json?base64_init=1'
|
||||||
|
|
|
@ -3,7 +3,6 @@ const url = require("url");
|
||||||
const https = require("https");
|
const https = require("https");
|
||||||
const log = (...args) => console.log("→", ...args);
|
const log = (...args) => console.log("→", ...args);
|
||||||
const list = require("./videojson.js");
|
const list = require("./videojson.js");
|
||||||
const promises = [];
|
|
||||||
|
|
||||||
function loadVideo(num, cb) {
|
function loadVideo(num, cb) {
|
||||||
let masterUrl = list[num].url;
|
let masterUrl = list[num].url;
|
||||||
|
@ -11,9 +10,9 @@ function loadVideo(num, cb) {
|
||||||
masterUrl += "?base64_init=1";
|
masterUrl += "?base64_init=1";
|
||||||
}
|
}
|
||||||
|
|
||||||
getJson(masterUrl, (err, json) => {
|
getJson(masterUrl, num, (err, json) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
const videoData = json.video
|
const videoData = json.video
|
||||||
|
@ -40,7 +39,7 @@ function loadVideo(num, cb) {
|
||||||
list[num].name + ".m4v",
|
list[num].name + ".m4v",
|
||||||
err => {
|
err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
processFile(
|
processFile(
|
||||||
|
@ -51,7 +50,7 @@ function loadVideo(num, cb) {
|
||||||
list[num].name + ".m4a",
|
list[num].name + ".m4a",
|
||||||
err => {
|
err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(null, num + 1);
|
cb(null, num + 1);
|
||||||
|
@ -66,11 +65,11 @@ function processFile(type, baseUrl, initData, segments, filename, cb) {
|
||||||
const filePath = `./parts/${filename}`;
|
const filePath = `./parts/${filename}`;
|
||||||
const downloadingFlag = `./parts/.${filename}~`;
|
const downloadingFlag = `./parts/.${filename}~`;
|
||||||
|
|
||||||
if(fs.existsSync(downloadingFlag)) {
|
if (fs.existsSync(downloadingFlag)) {
|
||||||
log("⚠️", ` ${filename} - ${type} is incomplete, restarting the download`);
|
log("⚠️", ` ${filename} - ${type} is incomplete, restarting the download`);
|
||||||
} else if (fs.existsSync(filePath)) {
|
} else if (fs.existsSync(filePath)) {
|
||||||
log("⚠️", ` ${filename} - ${type} already exists`);
|
log("⚠️", ` ${filename} - ${type} already exists`);
|
||||||
return cb();
|
cb();
|
||||||
} else {
|
} else {
|
||||||
fs.writeFileSync(downloadingFlag, '');
|
fs.writeFileSync(downloadingFlag, '');
|
||||||
}
|
}
|
||||||
|
@ -98,7 +97,7 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
||||||
if (i >= segmentsUrl.length) {
|
if (i >= segmentsUrl.length) {
|
||||||
fs.unlinkSync(downloadingFlag);
|
fs.unlinkSync(downloadingFlag);
|
||||||
log("🏁", ` ${filename} - ${type} done`);
|
log("🏁", ` ${filename} - ${type} done`);
|
||||||
return cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
|
||||||
log(
|
log(
|
||||||
|
@ -125,14 +124,17 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getJson(url, cb) {
|
function getJson(url, n, cb) {
|
||||||
let data = "";
|
let data = "";
|
||||||
|
|
||||||
https
|
https
|
||||||
.get(url, res => {
|
.get(url, res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
res.on("data", d => (data += d));
|
res.on("data", d => (data += d));
|
||||||
|
|
||||||
res.on("end", () => cb(null, JSON.parse(data)));
|
res.on("end", () => cb(null, JSON.parse(data)));
|
||||||
|
} else {
|
||||||
|
log("⏱️", ` The master.json file is expired or crushed. Please update or remove it from the sequence (broken on ` + n + ` position)`);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.on("error", e => {
|
.on("error", e => {
|
||||||
cb(e);
|
cb(e);
|
||||||
|
@ -145,7 +147,6 @@ function initJs(n = 0) {
|
||||||
loadVideo(n, (err, num) => {
|
loadVideo(n, (err, num) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log("⚠️", ` ${err}`);
|
log("⚠️", ` ${err}`);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list[num]) {
|
if (list[num]) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue