aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerik-nilcoast <138068205+erik-nilcoast@users.noreply.github.com>2025-03-16 16:58:18 -0500
committerGitHub <noreply@github.com>2025-03-16 21:58:18 +0000
commitbffbd43672ca9c3366b0e94c20fadb26d86dfdb9 (patch)
tree7e33979062f0dc45f0397026b7ad795c15b49450
parent6bbf4cb1b9c4477a2db49a8151f7b79537c95637 (diff)
downloadkarakeep-bffbd43672ca9c3366b0e94c20fadb26d86dfdb9.tar.zst
feat(workers): allows videoWorker to use ytdlp command line arguments specified in the config. Fixes #775 #792 (#1117)
-rw-r--r--apps/workers/videoWorker.ts3
-rw-r--r--docs/docs/03-configuration.md1
-rw-r--r--packages/shared/config.ts5
3 files changed, 8 insertions, 1 deletions
diff --git a/apps/workers/videoWorker.ts b/apps/workers/videoWorker.ts
index 32f16f97..23ead8f8 100644
--- a/apps/workers/videoWorker.ts
+++ b/apps/workers/videoWorker.ts
@@ -63,7 +63,6 @@ export class VideoWorker {
}
function prepareYtDlpArguments(url: string, assetPath: string) {
- // TODO allow custom commandline arguments?
const ytDlpArguments = [url];
if (serverConfig.crawler.maxVideoDownloadSize > 0) {
ytDlpArguments.push(
@@ -71,6 +70,8 @@ function prepareYtDlpArguments(url: string, assetPath: string) {
`best[filesize<${serverConfig.crawler.maxVideoDownloadSize}M]`,
);
}
+
+ ytDlpArguments.push(...serverConfig.crawler.ytDlpArguments);
ytDlpArguments.push("-o", assetPath);
ytDlpArguments.push("--no-playlist");
return ytDlpArguments;
diff --git a/docs/docs/03-configuration.md b/docs/docs/03-configuration.md
index 27f9f14e..36de8295 100644
--- a/docs/docs/03-configuration.md
+++ b/docs/docs/03-configuration.md
@@ -87,6 +87,7 @@ Either `OPENAI_API_KEY` or `OLLAMA_BASE_URL` need to be set for automatic taggin
| CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE | No | 50 | The maximum file size for the downloaded video. The quality will be chosen accordingly. Use -1 to disable the limit. |
| CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC | No | 600 | How long to wait for the video download to finish |
| CRAWLER_ENABLE_ADBLOCKER | No | true | Whether to enable an adblocker in the crawler or not. If you're facing troubles downloading the adblocking lists on worker startup, you can disable this. |
+| CRAWLER_YTDLP_ARGS | No | [] | Include additional yt-dlp arguments to be passed at crawl time separated by %%: https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#general-options
## OCR Configs
diff --git a/packages/shared/config.ts b/packages/shared/config.ts
index 1295fdbf..f487478f 100644
--- a/packages/shared/config.ts
+++ b/packages/shared/config.ts
@@ -49,6 +49,10 @@ const allEnv = z.object({
CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE: z.coerce.number().default(50),
CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC: z.coerce.number().default(10 * 60),
CRAWLER_ENABLE_ADBLOCKER: stringBool("true"),
+ CRAWLER_YTDLP_ARGS: z
+ .string()
+ .default("")
+ .transform((t) => t.split("%%").filter((a) => a)),
MEILI_ADDR: z.string().optional(),
MEILI_MASTER_KEY: z.string().default(""),
LOG_LEVEL: z.string().default("debug"),
@@ -116,6 +120,7 @@ const serverConfigSchema = allEnv.transform((val) => {
maxVideoDownloadSize: val.CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE,
downloadVideoTimeout: val.CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC,
enableAdblocker: val.CRAWLER_ENABLE_ADBLOCKER,
+ ytDlpArguments: val.CRAWLER_YTDLP_ARGS,
},
ocr: {
langs: val.OCR_LANGS,