Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/snobu/destreamer into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaarma committed Mar 31, 2020
2 parents b4b2901 + d3fccb1 commit f96f004
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,23 @@ Options:
[boolean] [default: false]
# Make sure you use the right escape char for your shell if using line breaks (as this example shows).
# For PowerShell your escape char is the backtick (`) instead of backslash (\), for cmd.exe use caret (^).
$ node destreamer.js --username [email protected] --outputDirectory "videos" \
--videoUrls "https://web.microsoftstream.com/video/VIDEO-1" \
"https://web.microsoftstream.com/video/VIDEO-2" \
"https://web.microsoftstream.com/video/VIDEO-3"
```

You can create a txt file containing your video urls, separated by `new line`, and run destreamer as follow:
You can create a `.txt` file containing your video URLs, one video per line. The text file can have any name, followed by the `.txt` extension. Run destreamer as follows:
```
$ node destreamer.js --username [email protected] --outputDirectory "videos" \
--videoUrls myUrlsFile.txt
--videoUrls list.txt
```

**DO NOT RUN IN AN ELEVATED SHELL ON WINDOWS**, not going to work, Chromium will keep crashing.

Passing `--username` is optional. It's there to make logging in faster (the username field will be populated automatically on the login form).

You can use an absolute path for `--outputDirectory`, for example `/mnt/videos`.
Expand Down
8 changes: 6 additions & 2 deletions destreamer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,11 @@ async function rentVideoForLater(videoUrls: string[], outputDirectory: string, u

// Add random index to prevent unwanted file overwrite!
let k = 0;
while (fs.existsSync(outputDirectory+"/"+title+".mp4"))
title += ' - '+(++k).toString();
let ntitle = title;
while (fs.existsSync(outputDirectory+"/"+ntitle+".mp4"))
ntitle = title+' - '+(++k).toString();

title = ntitle;

term.blue("Video title is: ");
console.log(`${title} \n`);
Expand Down Expand Up @@ -293,6 +296,7 @@ function getVideoUrls() {
// FIXME
process.on('unhandledRejection', (reason, promise) => {
term.red("Unhandled error!\nTimeout or fatal error, please check your downloads and try again if necessary.\n");
term.red(reason);
throw new Error("Killing process..\n");
});

Expand Down

0 comments on commit f96f004

Please sign in to comment.