diff --git a/src/lib/helpers/youtubePlayerHandling.ts b/src/lib/helpers/youtubePlayerHandling.ts index 7dd6fbe..ca5aadc 100644 --- a/src/lib/helpers/youtubePlayerHandling.ts +++ b/src/lib/helpers/youtubePlayerHandling.ts @@ -16,7 +16,15 @@ if (Deno.env.get("YT_PLAYER_REQ_LOCATION")) { } const { youtubePlayerReq } = await import(youtubePlayerReqLocation); -const kv = await Deno.openKv(); +const videoCachePath = Deno.env.get("VIDEO_CACHE_PATH") as string || "/var/tmp/youtubei.js/video_cache" + +let kv : Deno.Kv +if ((Deno.env.get("VIDEO_CACHE_ON_DISK") as string).toLowerCase() == "true") { + console.log("[INFO] Storing video cache on disk") + kv = await Deno.openKv(videoCachePath); +} else { + kv = await Deno.openKv(); +} export const youtubePlayerParsing = async ( innertubeClient: Innertube,