From 9987b838b6daeb6e9567384d1beede423ca3e759 Mon Sep 17 00:00:00 2001 From: "nima.taheri@hootsuite.com" Date: Wed, 10 Aug 2022 12:33:36 -0700 Subject: [PATCH 1/4] chore: ignore more IDE/build files --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8a80599..e844a2f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,14 @@ # Example .gitignore files: https://github.com/github/gitignore /bower_components/ /node_modules/ +package-lock.json +yarn.lock *.m4a *.m4v *.zip converted/*.mp4 -combine.sh \ No newline at end of file +combine.sh + +.idea +.vscode From b8fe708f774e4e4f3bc8360913e5d6d7d706a690 Mon Sep 17 00:00:00 2001 From: "nima.taheri@hootsuite.com" Date: Wed, 10 Aug 2022 12:27:27 -0700 Subject: [PATCH 2/4] feat: Better error handling on segment download side --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 4d76437..4b76dee 100644 --- a/index.js +++ b/index.js @@ -122,6 +122,10 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag let req = https .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("end", () => From 8cfdb466d57083faf5bee1bfdecb705f17056239 Mon Sep 17 00:00:00 2001 From: "nima.taheri@hootsuite.com" Date: Wed, 10 Aug 2022 12:28:00 -0700 Subject: [PATCH 3/4] feat: Better error handling on segment-url extraction --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4b76dee..eba530e 100644 --- a/index.js +++ b/index.js @@ -86,7 +86,12 @@ function processFile(type, baseUrl, initData, segments, filename, cb) { 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"); fs.writeFileSync(filePath, initBuffer); From 6ea49d2d7a39abfa98818982e6f60a2f70d52984 Mon Sep 17 00:00:00 2001 From: "nima.taheri@hootsuite.com" Date: Wed, 10 Aug 2022 12:33:14 -0700 Subject: [PATCH 4/4] feat: Remove url sanitization and let users manually figure that out In my case changing the url actually broke the script, the original url worked just fine --- README.md | 1 + index.js | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 01f14d0..33d2f7b 100644 --- a/README.md +++ b/README.md @@ -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). 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.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 5. Run: `node index.js` or `npm run start` 6. Wait for console output `🌈 List finished` diff --git a/index.js b/index.js index eba530e..985e215 100644 --- a/index.js +++ b/index.js @@ -6,9 +6,6 @@ const list = require("./videojson.js"); function loadVideo(num, cb) { let rawMasterUrl = new URL(list[num].url); - rawMasterUrl.searchParams.delete('query_string_ranges'); - rawMasterUrl.searchParams.set('base64_init', 1); - let masterUrl = rawMasterUrl.toString(); getJson(masterUrl, num, (err, json) => {