Files
ejs/src/yt/solver/setup.ts
2026-03-17 16:12:08 +00:00

37 lines
1.0 KiB
TypeScript

import { parse } from "meriyah";
export const setupNodes = parse(`
if (typeof globalThis.XMLHttpRequest === "undefined") {
globalThis.XMLHttpRequest = { prototype: {} };
}
if (typeof URL === "undefined") {
globalThis.location = {
hash: "",
host: "www.youtube.com",
hostname: "www.youtube.com",
href: "https://www.youtube.com/watch?v=yt-dlp-wins",
origin: "https://www.youtube.com",
password: "",
pathname: "/watch",
port: "",
protocol: "https:",
search: "?v=yt-dlp-wins",
username: "",
};
} else {
globalThis.location = new URL("https://www.youtube.com/watch?v=yt-dlp-wins");
}
if (typeof globalThis.document === "undefined") {
globalThis.document = Object.create(null);
}
if (typeof globalThis.navigator === "undefined") {
globalThis.navigator = Object.create(null);
}
if (typeof globalThis.self === "undefined") {
globalThis.self = globalThis;
}
if (typeof globalThis.window === "undefined") {
globalThis.window = globalThis;
}
`).body;