mirror of
https://github.com/tedkulp/vidgrab
synced 2026-03-05 13:20:27 -05:00
Allow posting directly to /queue. Uses "best" format if not passed.
This commit is contained in:
@@ -3,8 +3,8 @@ export class UploadDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class QueueDto {
|
export class QueueDto {
|
||||||
format: number;
|
format? = 'best';
|
||||||
url: string;
|
url: string;
|
||||||
title: string;
|
title?: string;
|
||||||
extractor: string;
|
extractor?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ export class WebController {
|
|||||||
@Redirect('/')
|
@Redirect('/')
|
||||||
@UsePipes(new ValidationPipe({ transform: true }))
|
@UsePipes(new ValidationPipe({ transform: true }))
|
||||||
async queue(@Body() body: QueueDto) {
|
async queue(@Body() body: QueueDto) {
|
||||||
|
if (!body.extractor || !body.title) {
|
||||||
|
const videoInfo = await this.ytdlService.getVideoInfo(body.url);
|
||||||
|
body.extractor = videoInfo.extractor;
|
||||||
|
body.title = videoInfo.title;
|
||||||
|
}
|
||||||
|
|
||||||
const job = await this.vidgrabQueue.add('download', body);
|
const job = await this.vidgrabQueue.add('download', body);
|
||||||
|
|
||||||
// Redirect to main page
|
// Redirect to main page
|
||||||
|
|||||||
Reference in New Issue
Block a user