mirror of
https://github.com/yt-dlp/ejs.git
synced 2026-06-13 08:42:29 +00:00
Ref: https://github.com/yt-dlp/yt-dlp/issues/16256 Co-authored-by: Simon Sawicki <contact@grub4k.dev>
37 lines
1.0 KiB
TypeScript
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;
|