forked from LuanRT/YouTube.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
28 lines (25 loc) · 1.02 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { getRuntime } from './src/utils/Utils';
// Polyfill fetch for node
if (getRuntime() === 'node') {
// eslint-disable-next-line
const undici = require('undici');
Reflect.set(globalThis, 'fetch', undici.fetch);
Reflect.set(globalThis, 'Headers', undici.Headers);
Reflect.set(globalThis, 'Request', undici.Request);
Reflect.set(globalThis, 'Response', undici.Response);
Reflect.set(globalThis, 'FormData', undici.FormData);
Reflect.set(globalThis, 'File', undici.File);
try {
// eslint-disable-next-line
const { ReadableStream } = require('node:stream/web');
Reflect.set(globalThis, 'ReadableStream', ReadableStream);
} catch { /* do nothing */ }
}
import Innertube from './src/Innertube';
export * from './src/utils';
export { YTNodes } from './src/parser/map';
export { default as Parser } from './src/parser';
export { default as Innertube } from './src/Innertube';
export { default as Session } from './src/core/Session';
export { default as Player } from './src/core/Player';
export default Innertube;