mirror of
https://github.com/yt-dlp/ejs.git
synced 2026-06-13 08:42:29 +00:00
Improve compatibility (#7)
This commit is contained in:
@@ -1,9 +1,36 @@
|
||||
import { parse } from "meriyah";
|
||||
|
||||
export const setupNodes = parse(`
|
||||
globalThis.XMLHttpRequest = { prototype: {} };
|
||||
const window = Object.assign(Object.create(null), globalThis);
|
||||
window.location = new URL("https://www.youtube.com/watch?v=yt-dlp-wins");
|
||||
const document = {};
|
||||
let self = globalThis;
|
||||
if (typeof globalThis.XMLHttpRequest === "undefined") {
|
||||
globalThis.XMLHttpRequest = { prototype: {} };
|
||||
}
|
||||
if (typeof globalThis.window === "undefined") {
|
||||
globalThis.window = Object.create(null);
|
||||
}
|
||||
if (typeof URL === "undefined") {
|
||||
globalThis.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 {
|
||||
globalThis.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;
|
||||
|
||||
Reference in New Issue
Block a user