allow to dynamically load external files for youtubeplayerreq + fetchclient

This commit is contained in:
Emilien 2024-11-18 00:31:11 +01:00
parent fe96551d7a
commit 7ed48ad2af
4 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import { Innertube, YT, ApiResponse } from "youtubei.js"; import { Innertube, YT, ApiResponse } from "youtubei.js";
import { generateRandomString } from "youtubei.js/Utils"; import { generateRandomString } from "youtubei.js/Utils";
import { compress, decompress } from "https://deno.land/x/brotli@0.1.7/mod.ts"; import { compress, decompress } from "https://deno.land/x/brotli@0.1.7/mod.ts";
import { youtubePlayerReq } from "youtubePlayerReq"; const { youtubePlayerReq } = await import(Deno.env.get("YT_PLAYER_REQ_LOCATION") || "./youtubePlayerReq.ts");
import { Store } from "@willsoto/node-konfig-core"; import { Store } from "@willsoto/node-konfig-core";
const kv = await Deno.openKv(); const kv = await Deno.openKv();

View file

@ -3,7 +3,7 @@ import type { BgConfig } from "bgutils";
import { JSDOM } from "jsdom"; import { JSDOM } from "jsdom";
import { Innertube, UniversalCache } from "youtubei.js"; import { Innertube, UniversalCache } from "youtubei.js";
import { Store } from "@willsoto/node-konfig-core"; import { Store } from "@willsoto/node-konfig-core";
import { getFetchClient } from "../helpers/getFetchClient.ts"; const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "../helpers/getFetchClient.ts");
// Adapted from https://github.com/LuanRT/BgUtils/blob/main/examples/node/index.ts // Adapted from https://github.com/LuanRT/BgUtils/blob/main/examples/node/index.ts
export const poTokenGenerate = async ( export const poTokenGenerate = async (

View file

@ -3,7 +3,7 @@ import { routes } from "./routes/index.ts";
import { Innertube, UniversalCache } from "youtubei.js"; import { Innertube, UniversalCache } from "youtubei.js";
import { poTokenGenerate } from "./lib/jobs/potoken.ts"; import { poTokenGenerate } from "./lib/jobs/potoken.ts";
import { konfigLoader } from "./lib/helpers/konfigLoader.ts"; import { konfigLoader } from "./lib/helpers/konfigLoader.ts";
import { getFetchClient } from "./lib/helpers/getFetchClient.ts"; const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "./lib/helpers/getFetchClient.ts");
const app = new Hono(); const app = new Hono();
const konfigStore = await konfigLoader(); const konfigStore = await konfigLoader();

View file

@ -1,6 +1,6 @@
import { Hono } from "hono"; import { Hono } from "hono";
import { Store } from "@willsoto/node-konfig-core"; import { Store } from "@willsoto/node-konfig-core";
import { getFetchClient } from "../lib/helpers/getFetchClient.ts"; const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "../lib/helpers/getFetchClient.ts");
import { HTTPException } from "hono/http-exception"; import { HTTPException } from "hono/http-exception";
const videoPlaybackProxy = new Hono(); const videoPlaybackProxy = new Hono();