mirror of
https://github.com/Tusko/vimeo-private-downloader.git
synced 2025-08-21 13:54:24 -07:00
Merge pull request #38 from nimatrueway/master
This commit is contained in:
commit
c03bdf4394
3 changed files with 17 additions and 5 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -3,9 +3,14 @@
|
||||||
# Example .gitignore files: https://github.com/github/gitignore
|
# Example .gitignore files: https://github.com/github/gitignore
|
||||||
/bower_components/
|
/bower_components/
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
*.m4a
|
*.m4a
|
||||||
*.m4v
|
*.m4v
|
||||||
*.zip
|
*.zip
|
||||||
converted/*.mp4
|
converted/*.mp4
|
||||||
combine.sh
|
combine.sh
|
||||||
|
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
|
|
@ -13,6 +13,7 @@ To download videos you have to:
|
||||||
1. Open the browser developer tools on the network tab (`F12` on Windows/Linux, `CMD + Option + I` on Mac OS).
|
1. Open the browser developer tools on the network tab (`F12` on Windows/Linux, `CMD + Option + I` on Mac OS).
|
||||||
2. Start the video (or move mouse over the video).
|
2. Start the video (or move mouse over the video).
|
||||||
3. In the "Network" tab, locate the load of the "master.json" file, copy its full URL.
|
3. In the "Network" tab, locate the load of the "master.json" file, copy its full URL.
|
||||||
|
3.1. In some cases Vimeo sends you encrypted video data, that you can workaround by either removing 'query_string_ranges' query parameter and/or adding 'base64_init=1' to it.
|
||||||
4. Fill in `url` and `name`(using as filename) fields in `videojson.js` file
|
4. Fill in `url` and `name`(using as filename) fields in `videojson.js` file
|
||||||
5. Run: `node index.js` or `npm run start`
|
5. Run: `node index.js` or `npm run start`
|
||||||
6. Wait for console output `🌈 List finished`
|
6. Wait for console output `🌈 List finished`
|
||||||
|
|
14
index.js
14
index.js
|
@ -6,9 +6,6 @@ const list = require("./videojson.js");
|
||||||
|
|
||||||
function loadVideo(num, cb) {
|
function loadVideo(num, cb) {
|
||||||
let rawMasterUrl = new URL(list[num].url);
|
let rawMasterUrl = new URL(list[num].url);
|
||||||
rawMasterUrl.searchParams.delete('query_string_ranges');
|
|
||||||
rawMasterUrl.searchParams.set('base64_init', 1);
|
|
||||||
|
|
||||||
let masterUrl = rawMasterUrl.toString();
|
let masterUrl = rawMasterUrl.toString();
|
||||||
|
|
||||||
getJson(masterUrl, num, (err, json) => {
|
getJson(masterUrl, num, (err, json) => {
|
||||||
|
@ -86,7 +83,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);
|
||||||
|
@ -122,6 +124,10 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
||||||
|
|
||||||
let req = https
|
let req = https
|
||||||
.get(segmentsUrl[i], res => {
|
.get(segmentsUrl[i], res => {
|
||||||
|
if (res.statusCode != 200) {
|
||||||
|
cb(new Error(`Downloading segment with url '${segmentsUrl[i]}' failed with status: ${res.statusCode} ${res.statusMessage}`))
|
||||||
|
}
|
||||||
|
|
||||||
res.on("data", d => output.write(d));
|
res.on("data", d => output.write(d));
|
||||||
|
|
||||||
res.on("end", () =>
|
res.on("end", () =>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue