1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-03-07 04:28:24 +00:00

changed function name to be more significant

This commit is contained in:
Luca
2020-04-10 12:59:09 +02:00
parent 51e86ae593
commit b3fd6544cc
3 changed files with 8 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { sleep, getVideoUrls, checkRequirements } from './utils'; import { sleep, parseVideoUrls, checkRequirements } from './utils';
import { TokenCache } from './TokenCache'; import { TokenCache } from './TokenCache';
import { getVideoMetadata } from './Metadata'; import { getVideoMetadata } from './Metadata';
import { Metadata, Session } from './Types'; import { Metadata, Session } from './Types';
@@ -78,6 +78,7 @@ function init() {
} }
async function DoInteractiveLogin(username?: string): Promise<Session> { async function DoInteractiveLogin(username?: string): Promise<Session> {
console.log('Launching headless Chrome to perform the OpenID Connect dance...'); console.log('Launching headless Chrome to perform the OpenID Connect dance...');
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: false, headless: false,
@@ -230,7 +231,7 @@ async function main() {
process.exit(-1); process.exit(-1);
} }
videoUrls = getVideoUrls(argv.videoUrls); videoUrls = parseVideoUrls(argv.videoUrls);
if (videoUrls.length === 0) { if (videoUrls.length === 0) {
console.error(colors.red('\nERROR: No valid URL has been found!\n')); console.error(colors.red('\nERROR: No valid URL has been found!\n'));
process.exit(-1); process.exit(-1);

View File

@@ -1,4 +1,4 @@
import { getVideoUrls } from '../utils'; import { parseVideoUrls } from '../utils';
import puppeteer from 'puppeteer'; import puppeteer from 'puppeteer';
import assert from 'assert'; import assert from 'assert';
import tmp from 'tmp'; import tmp from 'tmp';
@@ -53,7 +53,7 @@ describe('Destreamer', () => {
fs.writeFileSync(tmpFile.fd, testIn.join('\r\n')); fs.writeFileSync(tmpFile.fd, testIn.join('\r\n'));
testOut = getVideoUrls([tmpFile.name]); testOut = parseVideoUrls([tmpFile.name]);
if (testOut.length !== expectedOut.length) if (testOut.length !== expectedOut.length)
assert.strictEqual(testOut, expectedOut, "URL list not sanitized"); assert.strictEqual(testOut, expectedOut, "URL list not sanitized");

View File

@@ -27,7 +27,7 @@ function sanitizeUrls(urls: string[]) {
return sanitized; return sanitized;
} }
export function getVideoUrls(videoUrls: any) { export function parseVideoUrls(videoUrls: any) {
const t = videoUrls[0] as string; const t = videoUrls[0] as string;
const isPath = t.substring(t.length-4) === '.txt'; const isPath = t.substring(t.length-4) === '.txt';
let urls: string[]; let urls: string[];