Files
ejs/src/yt/solver/setup.ts
2025-10-22 01:14:14 +02:00

35 lines
1002 B
TypeScript

import { parse } from "meriyah";
export const setupNodes = parse(`
if (typeof globalThis.XMLHttpRequest === "undefined") {
globalThis.XMLHttpRequest = { prototype: {} };
}
const window = Object.create(null);
if (typeof URL === "undefined") {
window.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 {
window.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;
}
`).body;