add support for UMP

This commit is contained in:
Emilien 2024-11-09 15:00:16 +01:00
parent e4140a9e1e
commit f60450d547
2 changed files with 33 additions and 1 deletions

View file

@ -12,6 +12,8 @@ directory = "/var/tmp"
[networking] [networking]
#proxy = "" #proxy = ""
# Enable YouTube new video format UMP
ump = false
[jobs] [jobs]

View file

@ -53,7 +53,29 @@ dashManifest.get("/:videoId", async (c) => {
) { ) {
return true; return true;
} else if ( } else if (
i.itag == Number(url.searchParams.get("itag")) && url.searchParams.has("xtags")
) {
if (
i.itag ==
Number(url.searchParams.get("itag")) &&
url.searchParams.get("xtags")?.includes(
i.language || "",
) &&
i.is_drc === url.search.includes("drc")
) {
return true;
} else if (
i.itag ==
Number(url.searchParams.get("itag")) &&
i.is_drc === url.search.includes("drc")
) {
return true;
} else {
return true;
}
} else if (
i.itag ==
Number(url.searchParams.get("itag")) &&
i.is_drc === url.search.includes("drc") i.is_drc === url.search.includes("drc")
) { ) {
return true; return true;
@ -61,11 +83,19 @@ dashManifest.get("/:videoId", async (c) => {
}); });
if (selectedItagFormat) { if (selectedItagFormat) {
let dashUrl = new URL(selectedItagFormat[0].url as string); let dashUrl = new URL(selectedItagFormat[0].url as string);
if (url.toString().includes("140")) {
console.log(url.toString());
console.log(dashUrl.toString());
console.log(selectedItagFormat[0]);
}
if (local) { if (local) {
// Can't create URL type without host part // Can't create URL type without host part
dashUrl = dashUrl =
(dashUrl.pathname + dashUrl.search + "&host=" + (dashUrl.pathname + dashUrl.search + "&host=" +
dashUrl.host) as unknown as URL; dashUrl.host) as unknown as URL;
if (konfigStore.get("networking.ump") as boolean) {
dashUrl = dashUrl + "&ump=1" as unknown as URL;
}
return dashUrl; return dashUrl;
} else { } else {
return dashUrl; return dashUrl;