chore: add proper documentation (#763)

* chore: generate API ref using `typedoc`

* chore: declutter readme and add links to ytjs.dev

* chore: clean up
This commit is contained in:
Luan
2024-09-23 17:32:50 -03:00
committed by GitHub
parent dd7f5cf778
commit 74659fd03f
853 changed files with 139814 additions and 1929 deletions

View File

@@ -0,0 +1,47 @@
[youtubei.js](../../README.md) / Utils
# Utils
## Index
### Classes
- [ChannelError](classes/ChannelError.md)
- [InnertubeError](classes/InnertubeError.md)
- [MissingParamError](classes/MissingParamError.md)
- [OAuth2Error](classes/OAuth2Error.md)
- [ParsingError](classes/ParsingError.md)
- [PlayerError](classes/PlayerError.md)
- [SessionError](classes/SessionError.md)
### Type Aliases
- [DeviceCategory](type-aliases/DeviceCategory.md)
- [FindFunctionArgs](type-aliases/FindFunctionArgs.md)
- [FindFunctionResult](type-aliases/FindFunctionResult.md)
### Functions
- [base64ToU8](functions/base64ToU8.md)
- [concatMemos](functions/concatMemos.md)
- [debugFetch](functions/debugFetch.md)
- [deepCompare](functions/deepCompare.md)
- [escapeStringRegexp](functions/escapeStringRegexp.md)
- [findFunction](functions/findFunction.md)
- [generateRandomString](functions/generateRandomString.md)
- [generateSidAuth](functions/generateSidAuth.md)
- [getCookie](functions/getCookie.md)
- [getRandomUserAgent](functions/getRandomUserAgent.md)
- [getStringBetweenStrings](functions/getStringBetweenStrings.md)
- [hasKeys](functions/hasKeys.md)
- [isTextRun](functions/isTextRun.md)
- [streamToIterable](functions/streamToIterable.md)
- [throwIfMissing](functions/throwIfMissing.md)
- [timeToSeconds](functions/timeToSeconds.md)
- [u8ToBase64](functions/u8ToBase64.md)
## References
### Platform
Re-exports [Platform](../../classes/Platform.md)

View File

@@ -0,0 +1,177 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / ChannelError
# Class: ChannelError
## Extends
- `Error`
## Constructors
### new ChannelError()
> **new ChannelError**(`message`?): [`ChannelError`](ChannelError.md)
#### Parameters
**message?**: `string`
#### Returns
[`ChannelError`](ChannelError.md)
#### Inherited from
`Error.constructor`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1082
### new ChannelError()
> **new ChannelError**(`message`?, `options`?): [`ChannelError`](ChannelError.md)
#### Parameters
**message?**: `string`
**options?**: `ErrorOptions`
#### Returns
[`ChannelError`](ChannelError.md)
#### Inherited from
`Error.constructor`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1082
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
`Error.cause`
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### message
> **message**: `string`
#### Inherited from
`Error.message`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
`Error.name`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
`Error.stack`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
`Error.prepareStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
`Error.stackTraceLimit`
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
`Error.captureStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,193 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / InnertubeError
# Class: InnertubeError
## Extends
- `Error`
## Extended by
- [`ParsingError`](ParsingError.md)
- [`MissingParamError`](MissingParamError.md)
- [`OAuth2Error`](OAuth2Error.md)
## Constructors
### new InnertubeError()
> **new InnertubeError**(`message`, `info`?): [`InnertubeError`](InnertubeError.md)
#### Parameters
**message**: `string`
**info?**: `any`
#### Returns
[`InnertubeError`](InnertubeError.md)
#### Overrides
`Error.constructor`
#### Defined in
[src/utils/Utils.ts:30](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L30)
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
`Error.cause`
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### date
> **date**: `Date`
#### Defined in
[src/utils/Utils.ts:26](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L26)
***
### info?
> `optional` **info**: `any`
#### Defined in
[src/utils/Utils.ts:28](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L28)
***
### message
> **message**: `string`
#### Inherited from
`Error.message`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
`Error.name`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
`Error.stack`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### version
> **version**: `string`
#### Defined in
[src/utils/Utils.ts:27](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L27)
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
`Error.prepareStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
`Error.stackTraceLimit`
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
`Error.captureStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,199 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / MissingParamError
# Class: MissingParamError
## Extends
- [`InnertubeError`](InnertubeError.md)
## Constructors
### new MissingParamError()
> **new MissingParamError**(`message`, `info`?): [`MissingParamError`](MissingParamError.md)
#### Parameters
**message**: `string`
**info?**: `any`
#### Returns
[`MissingParamError`](MissingParamError.md)
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`constructor`](InnertubeError.md#constructors)
#### Defined in
[src/utils/Utils.ts:30](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L30)
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`cause`](InnertubeError.md#cause)
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### date
> **date**: `Date`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`date`](InnertubeError.md#date)
#### Defined in
[src/utils/Utils.ts:26](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L26)
***
### info?
> `optional` **info**: `any`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`info`](InnertubeError.md#info)
#### Defined in
[src/utils/Utils.ts:28](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L28)
***
### message
> **message**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`message`](InnertubeError.md#message)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`name`](InnertubeError.md#name)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`stack`](InnertubeError.md#stack)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### version
> **version**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`version`](InnertubeError.md#version)
#### Defined in
[src/utils/Utils.ts:27](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L27)
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`prepareStackTrace`](InnertubeError.md#preparestacktrace)
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`stackTraceLimit`](InnertubeError.md#stacktracelimit)
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`captureStackTrace`](InnertubeError.md#capturestacktrace)
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,199 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / OAuth2Error
# Class: OAuth2Error
## Extends
- [`InnertubeError`](InnertubeError.md)
## Constructors
### new OAuth2Error()
> **new OAuth2Error**(`message`, `info`?): [`OAuth2Error`](OAuth2Error.md)
#### Parameters
**message**: `string`
**info?**: `any`
#### Returns
[`OAuth2Error`](OAuth2Error.md)
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`constructor`](InnertubeError.md#constructors)
#### Defined in
[src/utils/Utils.ts:30](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L30)
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`cause`](InnertubeError.md#cause)
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### date
> **date**: `Date`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`date`](InnertubeError.md#date)
#### Defined in
[src/utils/Utils.ts:26](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L26)
***
### info?
> `optional` **info**: `any`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`info`](InnertubeError.md#info)
#### Defined in
[src/utils/Utils.ts:28](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L28)
***
### message
> **message**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`message`](InnertubeError.md#message)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`name`](InnertubeError.md#name)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`stack`](InnertubeError.md#stack)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### version
> **version**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`version`](InnertubeError.md#version)
#### Defined in
[src/utils/Utils.ts:27](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L27)
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`prepareStackTrace`](InnertubeError.md#preparestacktrace)
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`stackTraceLimit`](InnertubeError.md#stacktracelimit)
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`captureStackTrace`](InnertubeError.md#capturestacktrace)
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,199 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / ParsingError
# Class: ParsingError
## Extends
- [`InnertubeError`](InnertubeError.md)
## Constructors
### new ParsingError()
> **new ParsingError**(`message`, `info`?): [`ParsingError`](ParsingError.md)
#### Parameters
**message**: `string`
**info?**: `any`
#### Returns
[`ParsingError`](ParsingError.md)
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`constructor`](InnertubeError.md#constructors)
#### Defined in
[src/utils/Utils.ts:30](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L30)
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`cause`](InnertubeError.md#cause)
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### date
> **date**: `Date`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`date`](InnertubeError.md#date)
#### Defined in
[src/utils/Utils.ts:26](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L26)
***
### info?
> `optional` **info**: `any`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`info`](InnertubeError.md#info)
#### Defined in
[src/utils/Utils.ts:28](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L28)
***
### message
> **message**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`message`](InnertubeError.md#message)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`name`](InnertubeError.md#name)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`stack`](InnertubeError.md#stack)
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### version
> **version**: `string`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`version`](InnertubeError.md#version)
#### Defined in
[src/utils/Utils.ts:27](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L27)
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`prepareStackTrace`](InnertubeError.md#preparestacktrace)
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`stackTraceLimit`](InnertubeError.md#stacktracelimit)
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
[`InnertubeError`](InnertubeError.md).[`captureStackTrace`](InnertubeError.md#capturestacktrace)
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,177 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / PlayerError
# Class: PlayerError
## Extends
- `Error`
## Constructors
### new PlayerError()
> **new PlayerError**(`message`?): [`PlayerError`](PlayerError.md)
#### Parameters
**message?**: `string`
#### Returns
[`PlayerError`](PlayerError.md)
#### Inherited from
`Error.constructor`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1082
### new PlayerError()
> **new PlayerError**(`message`?, `options`?): [`PlayerError`](PlayerError.md)
#### Parameters
**message?**: `string`
**options?**: `ErrorOptions`
#### Returns
[`PlayerError`](PlayerError.md)
#### Inherited from
`Error.constructor`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1082
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
`Error.cause`
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### message
> **message**: `string`
#### Inherited from
`Error.message`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
`Error.name`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
`Error.stack`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
`Error.prepareStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
`Error.stackTraceLimit`
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
`Error.captureStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,177 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / SessionError
# Class: SessionError
## Extends
- `Error`
## Constructors
### new SessionError()
> **new SessionError**(`message`?): [`SessionError`](SessionError.md)
#### Parameters
**message?**: `string`
#### Returns
[`SessionError`](SessionError.md)
#### Inherited from
`Error.constructor`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1082
### new SessionError()
> **new SessionError**(`message`?, `options`?): [`SessionError`](SessionError.md)
#### Parameters
**message?**: `string`
**options?**: `ErrorOptions`
#### Returns
[`SessionError`](SessionError.md)
#### Inherited from
`Error.constructor`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1082
## Properties
### cause?
> `optional` **cause**: `unknown`
#### Inherited from
`Error.cause`
#### Defined in
node\_modules/typescript/lib/lib.es2022.error.d.ts:24
***
### message
> **message**: `string`
#### Inherited from
`Error.message`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1077
***
### name
> **name**: `string`
#### Inherited from
`Error.name`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1076
***
### stack?
> `optional` **stack**: `string`
#### Inherited from
`Error.stack`
#### Defined in
node\_modules/typescript/lib/lib.es5.d.ts:1078
***
### prepareStackTrace()?
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
Optional override for formatting stack traces
#### Parameters
**err**: `Error`
**stackTraces**: `CallSite`[]
#### Returns
`any`
#### See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
#### Inherited from
`Error.prepareStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:11
***
### stackTraceLimit
> `static` **stackTraceLimit**: `number`
#### Inherited from
`Error.stackTraceLimit`
#### Defined in
node\_modules/@types/node/globals.d.ts:13
## Methods
### captureStackTrace()
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
Create .stack property on a target object
#### Parameters
**targetObject**: `object`
**constructorOpt?**: `Function`
#### Returns
`void`
#### Inherited from
`Error.captureStackTrace`
#### Defined in
node\_modules/@types/node/globals.d.ts:4

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / base64ToU8
# Function: base64ToU8()
> **base64ToU8**(`base64`): `Uint8Array`
## Parameters
**base64**: `string`
## Returns
`Uint8Array`
## Defined in
[src/utils/Utils.ts:236](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L236)

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / concatMemos
# Function: concatMemos()
> **concatMemos**(...`iterables`): [`Memo`](../../Helpers/classes/Memo.md)
## Parameters
• ...**iterables**: (`undefined` \| [`Memo`](../../Helpers/classes/Memo.md))[]
## Returns
[`Memo`](../../Helpers/classes/Memo.md)
## Defined in
[src/utils/Utils.ts:140](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L140)

View File

@@ -0,0 +1,21 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / debugFetch
# Function: debugFetch()
> **debugFetch**(`input`, `init`?): `Promise`\<`Response`\>
[MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch)
## Parameters
**input**: `URL` \| `RequestInfo`
**init?**: `RequestInit`
## Returns
`Promise`\<`Response`\>
## Defined in
[src/utils/Utils.ts:191](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L191)

View File

@@ -0,0 +1,22 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / deepCompare
# Function: deepCompare()
> **deepCompare**(`obj1`, `obj2`): `boolean`
Compares given objects. May not work correctly for
objects with methods.
## Parameters
**obj1**: `any`
**obj2**: `any`
## Returns
`boolean`
## Defined in
[src/utils/Utils.ts:53](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L53)

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / escapeStringRegexp
# Function: escapeStringRegexp()
> **escapeStringRegexp**(`input`): `string`
## Parameters
**input**: `string`
## Returns
`string`
## Defined in
[src/utils/Utils.ts:76](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L76)

View File

@@ -0,0 +1,30 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / findFunction
# Function: findFunction()
> **findFunction**(`source`, `args`): [`FindFunctionResult`](../type-aliases/FindFunctionResult.md) \| `undefined`
Finds a function in a source string based on the provided search criteria.
## Parameters
**source**: `string`
**args**: [`FindFunctionArgs`](../type-aliases/FindFunctionArgs.md)
## Returns
[`FindFunctionResult`](../type-aliases/FindFunctionResult.md) \| `undefined`
## Example
```ts
const source = '(function() {var foo, bar; foo = function() { console.log("foo"); }; bar = function() { console.log("bar"); }; })();';
const result = findFunction(source, { name: 'bar' });
console.log(result);
// Output: { start: 69, end: 110, name: 'bar', node: { ... }, result: 'bar = function() { console.log("bar"); };' }
```
## Defined in
[src/utils/Utils.ts:288](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L288)

View File

@@ -0,0 +1,19 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / generateRandomString
# Function: generateRandomString()
> **generateRandomString**(`length`): `string`
Generates a random string with the given length.
## Parameters
**length**: `number`
## Returns
`string`
## Defined in
[src/utils/Utils.ts:110](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L110)

View File

@@ -0,0 +1,21 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / generateSidAuth
# Function: generateSidAuth()
> **generateSidAuth**(`sid`): `Promise`\<`string`\>
Generates an authentication token from a cookies' sid.
## Parameters
**sid**: `string`
Sid extracted from cookies
## Returns
`Promise`\<`string`\>
## Defined in
[src/utils/Utils.ts:96](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L96)

View File

@@ -0,0 +1,21 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / getCookie
# Function: getCookie()
> **getCookie**(`cookies`, `name`, `matchWholeName`): `string` \| `undefined`
## Parameters
**cookies**: `string`
**name**: `string`
**matchWholeName**: `boolean` = `false`
## Returns
`string` \| `undefined`
## Defined in
[src/utils/Utils.ts:246](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L246)

View File

@@ -0,0 +1,21 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / getRandomUserAgent
# Function: getRandomUserAgent()
> **getRandomUserAgent**(`type`): `string`
Returns a random user agent.
## Parameters
**type**: [`DeviceCategory`](../type-aliases/DeviceCategory.md)
mobile | desktop
## Returns
`string`
## Defined in
[src/utils/Utils.ts:86](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L86)

View File

@@ -0,0 +1,29 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / getStringBetweenStrings
# Function: getStringBetweenStrings()
> **getStringBetweenStrings**(`data`, `start_string`, `end_string`): `string` \| `undefined`
Finds a string between two delimiters.
## Parameters
**data**: `string`
the data.
**start\_string**: `string`
start string.
**end\_string**: `string`
end string.
## Returns
`string` \| `undefined`
## Defined in
[src/utils/Utils.ts:70](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L70)

View File

@@ -0,0 +1,25 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / hasKeys
# Function: hasKeys()
> **hasKeys**\<`T`, `R`\>(`params`, ...`keys`): `params is Exclude<T, R[number]> & Required<Pick<T, R[number]>>`
## Type Parameters
**T** *extends* `object`
**R** *extends* keyof `T`[]
## Parameters
**params**: `T`
• ...**keys**: `R`
## Returns
`params is Exclude<T, R[number]> & Required<Pick<T, R[number]>>`
## Defined in
[src/utils/Utils.ts:167](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L167)

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / isTextRun
# Function: isTextRun()
> **isTextRun**(`run`): `run is TextRun`
## Parameters
**run**: [`EmojiRun`](../../Misc/classes/EmojiRun.md) \| [`TextRun`](../../Misc/classes/TextRun.md)
## Returns
`run is TextRun`
## Defined in
[src/utils/Utils.ts:242](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L242)

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / streamToIterable
# Function: streamToIterable()
> **streamToIterable**(`stream`): `AsyncGenerator`\<`Uint8Array`, `void`, `unknown`\>
## Parameters
**stream**: `ReadableStream`\<`Uint8Array`\>
## Returns
`AsyncGenerator`\<`Uint8Array`, `void`, `unknown`\>
## Defined in
[src/utils/Utils.ts:175](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L175)

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / throwIfMissing
# Function: throwIfMissing()
> **throwIfMissing**(`params`): `void`
## Parameters
**params**: `object`
## Returns
`void`
## Defined in
[src/utils/Utils.ts:160](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L160)

View File

@@ -0,0 +1,21 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / timeToSeconds
# Function: timeToSeconds()
> **timeToSeconds**(`time`): `number`
Converts time (h:m:s) to seconds.
## Parameters
**time**: `string`
## Returns
`number`
seconds
## Defined in
[src/utils/Utils.ts:126](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L126)

View File

@@ -0,0 +1,17 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / u8ToBase64
# Function: u8ToBase64()
> **u8ToBase64**(`u8`): `string`
## Parameters
**u8**: `Uint8Array`
## Returns
`string`
## Defined in
[src/utils/Utils.ts:232](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L232)

View File

@@ -0,0 +1,9 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / DeviceCategory
# Type Alias: DeviceCategory
> **DeviceCategory**: `"mobile"` \| `"desktop"`
## Defined in
[src/utils/Utils.ts:80](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L80)

View File

@@ -0,0 +1,29 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / FindFunctionArgs
# Type Alias: FindFunctionArgs
> **FindFunctionArgs**: `object`
## Type declaration
### includes?
> `optional` **includes**: `string`
A string that must be included in the function's code for it to be considered.
### name?
> `optional` **name**: `string`
The name of the function.
### regexp?
> `optional` **regexp**: `RegExp`
A regular expression that the function's code must match.
## Defined in
[src/utils/Utils.ts:252](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L252)

View File

@@ -0,0 +1,31 @@
[youtubei.js](../../../README.md) / [Utils](../README.md) / FindFunctionResult
# Type Alias: FindFunctionResult
> **FindFunctionResult**: `object`
## Type declaration
### end
> **end**: `number`
### name
> **name**: `string`
### node
> **node**: `Record`\<`string`, `any`\>
### result
> **result**: `string`
### start
> **start**: `number`
## Defined in
[src/utils/Utils.ts:269](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L269)