1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-27 02:12:19 +00:00

Code cleanup to cleanly lint, added lint step to GitHub Action (#138)

This commit is contained in:
Adrian Calinescu
2020-05-18 22:36:38 +03:00
committed by GitHub
parent 1f6870128b
commit 6132f895f3
7 changed files with 116 additions and 133 deletions

View File

@@ -36,28 +36,28 @@ export const argv = yargs.options({
},
noExperiments: {
alias: 'x',
describe: `Do not attempt to render video thumbnails in the console`,
describe: 'Do not attempt to render video thumbnails in the console',
type: 'boolean',
default: false,
demandOption: false
},
simulate: {
alias: 's',
describe: `Disable video download and print metadata information to the console`,
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)`,
describe: 'Print additional information to the console (use this before opening an issue on GitHub)',
type: 'boolean',
default: false,
demandOption: false
},
noCleanup: {
alias: 'nc',
describe: `Don't delete the downloaded video file when an FFmpeg error occurs`,
describe: 'Do not delete the downloaded video file when an FFmpeg error occurs',
type: 'boolean',
default: false,
demandOption: false

View File

@@ -11,6 +11,7 @@ export function getPuppeteerChromiumPath() {
if (!isPkg)
return puppeteer.executablePath();
return puppeteer.executablePath()
.replace(replaceRegex, path.join(path.dirname(process.execPath), 'chromium'))
return puppeteer
.executablePath()
.replace(replaceRegex, path.join(path.dirname(process.execPath), 'chromium'));
}

View File

@@ -6,6 +6,7 @@ import fs from 'fs';
import path from 'path';
function sanitizeUrls(urls: string[]) {
// eslint-disable-next-line
const rex = new RegExp(/(?:https:\/\/)?.*\/video\/[a-z0-9]{8}-(?:[a-z0-9]{4}\-){3}[a-z0-9]{12}$/, 'i');
const sanitized: string[] = [];

View File

@@ -44,7 +44,7 @@ async function init() {
}
async function DoInteractiveLogin(url: string, username?: string): Promise<Session> {
const videoId = url.split("/").pop() ?? process.exit(ERROR_CODE.INVALID_VIDEO_ID)
const videoId = url.split('/').pop() ?? process.exit(ERROR_CODE.INVALID_VIDEO_ID);
console.log('Launching headless Chrome to perform the OpenID Connect dance...');
const browser = await puppeteer.launch({