diff --git a/.eslintrc.json b/.eslintrc.json index 56981f4..931bc31 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,6 +23,10 @@ "semi": [2, "always"], "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error", - "quotes": [2, "single", { "avoidEscape": true }] + "quotes": [2, "single", { "avoidEscape": true }], + "padding-line-between-statements": [ + "error", + { "blankLine": "always", "prev": "*", "next": "return" } + ] } } \ No newline at end of file diff --git a/README.md b/README.md index f873403..1b51671 100644 --- a/README.md +++ b/README.md @@ -85,21 +85,33 @@ Options: [boolean] [default: false] ``` -Make sure you use the right escape char for your shell if using line breaks (as this example shows). +Make sure you use the right escape char for your shell if using line breaks. -For PowerShell your escape char is the backtick (`) instead of backslash (\\), for cmd.exe use caret (^). - -``` -$ node destreamer.js --username username@example.com --outputDirectory "videos" \ +Bash — +```bash +./destreamer.sh --username username@example.com --outputDirectory "videos" \ --videoUrls "https://web.microsoftstream.com/video/VIDEO-1" \ - "https://web.microsoftstream.com/video/VIDEO-2" \ - "https://web.microsoftstream.com/video/VIDEO-3" + "https://web.microsoftstream.com/video/VIDEO-2" +``` + +PowerShell — +```powershell +.\destreamer.ps1 --username username@example.com --outputDirectory "videos" ` + --videoUrls "https://web.microsoftstream.com/video/VIDEO-1" ` + "https://web.microsoftstream.com/video/VIDEO-2" +``` + +cmd.exe — +```cmd +destreamer --username username@example.com --outputDirectory "videos" ^ + --videoUrls "https://web.microsoftstream.com/video/VIDEO-1" ^ + "https://web.microsoftstream.com/video/VIDEO-2" ``` 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 username@example.com --outputDirectory "videos" \ - --videoUrls list.txt +./destreamer.sh --username username@example.com --outputDirectory "videos" \ + --videoUrlsFile list.txt ``` Passing `--username` is optional. It's there to make logging in faster (the username field will be populated automatically on the login form). @@ -108,7 +120,6 @@ You can use an absolute path for `--outputDirectory`, for example `/mnt/videos`. ## RANDOM NOTE -## IMPORTANT NOTE Just ignore this error, we already have what we need to start the download, no time to deal with collaterals - ![image](https://user-images.githubusercontent.com/6472374/77905069-4c585000-728e-11ea-914e-26f1ce5e595b.png) diff --git a/package-lock.json b/package-lock.json index 95e5bec..6abe657 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "destreamer", - "version": "1.0.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fcd3a51..bf78501 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,13 @@ "type": "git", "url": "git://github.com/snobu/destreamer.git" }, - "version": "1.0.0", + "version": "2.0.0", "description": "Save Microsoft Stream videos for offline enjoyment.", "main": "build/src/destreamer.js", "bin": "build/src/destreamer.js", "scripts": { "build": "echo Transpiling TypeScript to JavaScript... & node node_modules/typescript/bin/tsc --listEmittedFiles", - "run": "node ./build/src/destreamer.js", - "start": "npm run -s build & npm run -s run", + "start": "node ./build/src/destreamer.js process.argv", "test": "mocha build/test" }, "keywords": [], diff --git a/src/CommandLineParser.ts b/src/CommandLineParser.ts index b887e23..3f2a61c 100644 --- a/src/CommandLineParser.ts +++ b/src/CommandLineParser.ts @@ -5,51 +5,43 @@ import colors from 'colors'; import fs from 'fs'; export const argv = yargs.options({ - videoUrls: { - alias: 'V', + url: { describe: 'List of video urls', type: 'array', demandOption: false }, - videoUrlsFile: { - alias: 'F', + 'from-file': { describe: 'Path to txt file containing the urls', type: 'string', demandOption: false }, username: { - alias: 'u', type: 'string', demandOption: false }, - outputDirectory: { - alias: 'o', + outdir: { describe: 'The directory where destreamer will save your downloads [default: videos]', type: 'string', demandOption: false }, - outputDirectories: { - alias: 'O', + 'out-dirs-from-file': { describe: 'Path to a txt file containing one output directory per video', type: 'string', demandOption: false }, - noThumbnails: { - alias: 'nthumb', - describe: `Do not display video thumbnails`, + 'no-experiments': { + describe: `Disable experimental features (do not display video thumbnails)`, type: 'boolean', default: false, demandOption: false }, simulate: { - alias: 's', describe: `Disable video download and print metadata information to the console`, type: 'boolean', default: false, demandOption: false }, verbose: { - alias: 'v', describe: `Print additional information to the console (use this before opening an issue on GitHub)`, type: 'boolean', default: false, diff --git a/src/Metadata.ts b/src/Metadata.ts index 1288177..becb3a3 100644 --- a/src/Metadata.ts +++ b/src/Metadata.ts @@ -60,6 +60,6 @@ export async function getVideoMetadata(videoGuids: string[], session: Session, v posterImage: posterImage }); })); - + return metadata; }