add support for an external videoplayback proxy
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 21s

This commit is contained in:
Fijxu 2024-12-14 03:17:34 -03:00
parent 687567a09e
commit 428db0810f
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
5 changed files with 20 additions and 3 deletions

View file

@ -1,7 +1,7 @@
[server] [server]
port = 8282 port = 8282
host = "127.0.0.1" host = "127.0.0.1"
secret_key = "CHANGE_ME" secret_key = "myBeautifulKey"
base_url = "http://localhost:8282" base_url = "http://localhost:8282"
verify_requests = false verify_requests = false
@ -15,6 +15,8 @@ directory = "/var/tmp"
#proxy = "" #proxy = ""
# Enable YouTube new video format UMP # Enable YouTube new video format UMP
ump = false ump = false
# Some external videoplayback
# external_videoplayback_proxy = ""
[jobs] [jobs]

View file

@ -13,6 +13,7 @@
"npm:@willsoto/node-konfig-file@3.0.0": "3.0.0_@willsoto+node-konfig-core@5.0.0", "npm:@willsoto/node-konfig-file@3.0.0": "3.0.0_@willsoto+node-konfig-core@5.0.0",
"npm:@willsoto/node-konfig-toml-parser@3.0.0": "3.0.0_@willsoto+node-konfig-core@5.0.0", "npm:@willsoto/node-konfig-toml-parser@3.0.0": "3.0.0_@willsoto+node-konfig-core@5.0.0",
"npm:acorn@^8.8.0": "8.14.0", "npm:acorn@^8.8.0": "8.14.0",
"npm:googlevideo@2.0.0": "2.0.0",
"npm:jsdom@25.0.1": "25.0.1" "npm:jsdom@25.0.1": "25.0.1"
}, },
"jsr": { "jsr": {
@ -40,6 +41,9 @@
} }
}, },
"npm": { "npm": {
"@bufbuild/protobuf@2.2.3": {
"integrity": "sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg=="
},
"@types/estree@1.0.6": { "@types/estree@1.0.6": {
"integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="
}, },
@ -123,6 +127,12 @@
"mime-types" "mime-types"
] ]
}, },
"googlevideo@2.0.0": {
"integrity": "sha512-OVlNWZ07TPIelaEII6mH9od+Cxljl7P4AzhEYVNN5d4FhFT9L5otpcLtgvraTE9u69KfVVw+L4pVeczArcD33w==",
"dependencies": [
"@bufbuild/protobuf"
]
},
"html-encoding-sniffer@4.0.0": { "html-encoding-sniffer@4.0.0": {
"integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
"dependencies": [ "dependencies": [

View file

@ -114,6 +114,8 @@ export const youtubePlayerParsing = async (
invidiousCompanion: { invidiousCompanion: {
"baseUrl": Deno.env.get("SERVER_BASE_URL") || "baseUrl": Deno.env.get("SERVER_BASE_URL") ||
konfigStore.get("server.base_url") as string, konfigStore.get("server.base_url") as string,
"external_videoplayback_proxy": Deno.env.get("EXTERNAL_VIDEOPLAYBACK_PROXY") ||
konfigStore.get("networking.external_videoplayback_proxy") as string,
}, },
}))(videoData); }))(videoData);

View file

@ -91,11 +91,12 @@ dashManifest.get("/:videoId", async (c) => {
let dashUrl = url; let dashUrl = url;
if (local) { if (local) {
// Can't create URL type without host part // Can't create URL type without host part
dashUrl = (dashUrl.pathname + dashUrl.search + "&host=" + dashUrl = (konfigStore.get("networking.external_videoplayback_proxy") as string ?? "") + (dashUrl.pathname + dashUrl.search + "&host=" +
dashUrl.host) as unknown as URL; dashUrl.host) as unknown as URL;
if (konfigStore.get("networking.ump") as boolean) { if (konfigStore.get("networking.ump") as boolean) {
dashUrl = dashUrl + "&ump=1" as unknown as URL; dashUrl = dashUrl + "&ump=1" as unknown as URL;
} }
console.log(dashUrl)
return dashUrl; return dashUrl;
} else { } else {
return dashUrl; return dashUrl;

View file

@ -69,9 +69,11 @@ latestVersion.get("/", async (c) => {
} else if (selectedItagFormat) { } else if (selectedItagFormat) {
const itagUrl = selectedItagFormat[0].url as string; const itagUrl = selectedItagFormat[0].url as string;
const itagUrlParsed = new URL(itagUrl); const itagUrlParsed = new URL(itagUrl);
console.log(itagUrlParsed)
let urlToRedirect = itagUrlParsed.toString(); let urlToRedirect = itagUrlParsed.toString();
if (local) { if (local) {
urlToRedirect = itagUrlParsed.pathname + urlToRedirect.search + urlToRedirect = konfigStore.get("networking.external_videoplayback_proxy") as string ?? "" +
itagUrlParsed.pathname + urlToRedirect.search +
"&host=" + itagUrlParsed.host; "&host=" + itagUrlParsed.host;
} }
return c.redirect(urlToRedirect); return c.redirect(urlToRedirect);