mirror of
https://github.com/snobu/destreamer.git
synced 2026-02-01 12:52:17 +00:00
Added audio/video quality option
Exposed native youtube-dl option "--format", that gives the ability to choose audio/video format and quality.
This commit is contained in:
@@ -13,12 +13,18 @@ const args: string[] = process.argv.slice(2); // TODO: Remove this
|
|||||||
const argv = yargs.options({
|
const argv = yargs.options({
|
||||||
videoUrls: { type: 'array', demandOption: true },
|
videoUrls: { type: 'array', demandOption: true },
|
||||||
username: { type: 'string', demandOption: true },
|
username: { type: 'string', demandOption: true },
|
||||||
outputDirectory: { type: 'string', default: 'videos' }
|
outputDirectory: { type: 'string', default: 'videos' },
|
||||||
|
format: {alias:"f",
|
||||||
|
describe: 'Expose youtube-dl --format option, for details see\n https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection',
|
||||||
|
type:'string',
|
||||||
|
default:'best'
|
||||||
|
}
|
||||||
}).argv;
|
}).argv;
|
||||||
|
|
||||||
console.info('Video URLs: %s', argv.videoUrls);
|
console.info('Video URLs: %s', argv.videoUrls);
|
||||||
console.info('Username: %s', argv.username);
|
console.info('Username: %s', argv.username);
|
||||||
console.info('Output Directory: %s', argv.outputDirectory);
|
console.info('Output Directory: %s', argv.outputDirectory);
|
||||||
|
console.info('Video/Audio Quality: %s', argv.format);
|
||||||
|
|
||||||
function sanityChecks() {
|
function sanityChecks() {
|
||||||
try {
|
try {
|
||||||
@@ -103,7 +109,7 @@ async function rentVideoForLater(videoUrls: string[], username: string, outputDi
|
|||||||
|
|
||||||
console.log('Spawning youtube-dl with cookie and HLS URL...');
|
console.log('Spawning youtube-dl with cookie and HLS URL...');
|
||||||
const youtubedlCmd = 'youtube-dl --no-call-home --no-warnings ' +
|
const youtubedlCmd = 'youtube-dl --no-call-home --no-warnings ' +
|
||||||
`--output "${outputDirectory}/${title}.mp4" --add-header Cookie:"${cookie}" "${hlsUrl}"`;
|
`-f "${argv.format}" --output "${outputDirectory}/${title}.mp4" --add-header Cookie:"${cookie}" "${hlsUrl}"`;
|
||||||
// console.log(`\n\n[DEBUG] Invoking youtube-dl: ${youtubedlCmd}\n\n`);
|
// console.log(`\n\n[DEBUG] Invoking youtube-dl: ${youtubedlCmd}\n\n`);
|
||||||
var result = execSync(youtubedlCmd, { stdio: 'inherit' });
|
var result = execSync(youtubedlCmd, { stdio: 'inherit' });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user