commit
2dd1a87905
4 changed files with 25 additions and 24 deletions
|
@ -1,4 +1,4 @@
|
|||
import { sleep, getVideoUrls, checkRequirements } from './utils';
|
||||
import { sleep, parseVideoUrls, checkRequirements } from './utils';
|
||||
import { TokenCache } from './TokenCache';
|
||||
import { getVideoMetadata } from './Metadata';
|
||||
import { Metadata, Session } from './Types';
|
||||
|
@ -78,6 +78,7 @@ function init() {
|
|||
}
|
||||
|
||||
async function DoInteractiveLogin(username?: string): Promise<Session> {
|
||||
|
||||
console.log('Launching headless Chrome to perform the OpenID Connect dance...');
|
||||
const browser = await puppeteer.launch({
|
||||
headless: false,
|
||||
|
@ -230,7 +231,7 @@ async function main() {
|
|||
process.exit(-1);
|
||||
}
|
||||
|
||||
videoUrls = getVideoUrls(argv.videoUrls);
|
||||
videoUrls = parseVideoUrls(argv.videoUrls);
|
||||
if (videoUrls.length === 0) {
|
||||
console.error(colors.red('\nERROR: No valid URL has been found!\n'));
|
||||
process.exit(-1);
|
||||
|
|
34
package-lock.json
generated
34
package-lock.json
generated
|
@ -1356,14 +1356,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"is-admin": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-admin/-/is-admin-3.0.0.tgz",
|
||||
"integrity": "sha512-wOa3CXFJAu8BZ2BDtG9xYOOrsq6oiSvc2jFPy4X/HINx5bmJUcW8e+apItVbU2E7GIfBVaFVO7Zit4oAWtTJcw==",
|
||||
"requires": {
|
||||
"execa": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-accessor-descriptor": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
|
||||
|
@ -1372,6 +1364,14 @@
|
|||
"kind-of": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"is-admin": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-admin/-/is-admin-3.0.0.tgz",
|
||||
"integrity": "sha512-wOa3CXFJAu8BZ2BDtG9xYOOrsq6oiSvc2jFPy4X/HINx5bmJUcW8e+apItVbU2E7GIfBVaFVO7Zit4oAWtTJcw==",
|
||||
"requires": {
|
||||
"execa": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-binary-path": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
|
@ -1406,15 +1406,6 @@
|
|||
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
|
||||
"dev": true
|
||||
},
|
||||
"is-elevated": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-elevated/-/is-elevated-3.0.0.tgz",
|
||||
"integrity": "sha512-wjcp6RkouU9jpg55zERl+BglvV5j4jx5c/EMvQ+d12j/+nIEenNWPu+qc0tCg3JkLodbKZMg1qhJzEwG4qjclg==",
|
||||
"requires": {
|
||||
"is-admin": "^3.0.0",
|
||||
"is-root": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"is-descriptor": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
|
||||
|
@ -1425,6 +1416,15 @@
|
|||
"kind-of": "^6.0.2"
|
||||
}
|
||||
},
|
||||
"is-elevated": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-elevated/-/is-elevated-3.0.0.tgz",
|
||||
"integrity": "sha512-wjcp6RkouU9jpg55zERl+BglvV5j4jx5c/EMvQ+d12j/+nIEenNWPu+qc0tCg3JkLodbKZMg1qhJzEwG4qjclg==",
|
||||
"requires": {
|
||||
"is-admin": "^3.0.0",
|
||||
"is-root": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getVideoUrls } from '../utils';
|
||||
import { parseVideoUrls } from '../utils';
|
||||
import puppeteer from 'puppeteer';
|
||||
import assert from 'assert';
|
||||
import tmp from 'tmp';
|
||||
|
@ -53,7 +53,7 @@ describe('Destreamer', () => {
|
|||
|
||||
fs.writeFileSync(tmpFile.fd, testIn.join('\r\n'));
|
||||
|
||||
testOut = getVideoUrls([tmpFile.name]);
|
||||
testOut = parseVideoUrls([tmpFile.name]);
|
||||
if (testOut.length !== expectedOut.length)
|
||||
assert.strictEqual(testOut, expectedOut, "URL list not sanitized");
|
||||
|
||||
|
@ -64,4 +64,4 @@ describe('Destreamer', () => {
|
|||
|
||||
assert.ok("sanitizeUrls ok");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
4
utils.ts
4
utils.ts
|
@ -27,7 +27,7 @@ function sanitizeUrls(urls: string[]) {
|
|||
return sanitized;
|
||||
}
|
||||
|
||||
export function getVideoUrls(videoUrls: any) {
|
||||
export function parseVideoUrls(videoUrls: any) {
|
||||
const t = videoUrls[0] as string;
|
||||
const isPath = t.substring(t.length-4) === '.txt';
|
||||
let urls: string[];
|
||||
|
@ -56,4 +56,4 @@ export function checkRequirements() {
|
|||
));
|
||||
process.exit(22);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue