Breaking changes in CLI params
This commit is contained in:
parent
176fa6e214
commit
c11c9b6334
6 changed files with 36 additions and 30 deletions
|
@ -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" }
|
||||
]
|
||||
}
|
||||
}
|
31
README.md
31
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 -
|
||||
|
||||

|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "destreamer",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -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": [],
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -60,6 +60,6 @@ export async function getVideoMetadata(videoGuids: string[], session: Session, v
|
|||
posterImage: posterImage
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue