Skip to content

Commit 3d8a742

Browse files
committed
feat(workers): allows videoWorker to use ytdlp command line arguments specified in the config
1 parent 7bffa02 commit 3d8a742

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

apps/workers/videoWorker.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ export class VideoWorker {
6363
}
6464

6565
function prepareYtDlpArguments(url: string, assetPath: string) {
66-
// TODO allow custom commandline arguments?
6766
const ytDlpArguments = [url];
6867
if (serverConfig.crawler.maxVideoDownloadSize > 0) {
6968
ytDlpArguments.push(
7069
"-f",
7170
`best[filesize<${serverConfig.crawler.maxVideoDownloadSize}M]`,
7271
);
7372
}
73+
74+
ytDlpArguments.push(...serverConfig.crawler.ytDlpArguments);
7475
ytDlpArguments.push("-o", assetPath);
7576
ytDlpArguments.push("--no-playlist");
7677
return ytDlpArguments;

packages/shared/config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ const allEnv = z.object({
4949
CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE: z.coerce.number().default(50),
5050
CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC: z.coerce.number().default(10 * 60),
5151
CRAWLER_ENABLE_ADBLOCKER: stringBool("true"),
52+
YTDLP_ARGS: z
53+
.string()
54+
.default("")
55+
.transform((t) => t.split("%%").filter((a) => a)),
5256
MEILI_ADDR: z.string().optional(),
5357
MEILI_MASTER_KEY: z.string().default(""),
5458
LOG_LEVEL: z.string().default("debug"),
@@ -116,6 +120,7 @@ const serverConfigSchema = allEnv.transform((val) => {
116120
maxVideoDownloadSize: val.CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE,
117121
downloadVideoTimeout: val.CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC,
118122
enableAdblocker: val.CRAWLER_ENABLE_ADBLOCKER,
123+
ytDlpArguments: val.YTDLP_ARGS,
119124
},
120125
ocr: {
121126
langs: val.OCR_LANGS,

0 commit comments

Comments
 (0)