mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
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:
17
docs/api/namespaces/Utils/functions/base64ToU8.md
Normal file
17
docs/api/namespaces/Utils/functions/base64ToU8.md
Normal 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)
|
||||
17
docs/api/namespaces/Utils/functions/concatMemos.md
Normal file
17
docs/api/namespaces/Utils/functions/concatMemos.md
Normal 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)
|
||||
21
docs/api/namespaces/Utils/functions/debugFetch.md
Normal file
21
docs/api/namespaces/Utils/functions/debugFetch.md
Normal 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)
|
||||
22
docs/api/namespaces/Utils/functions/deepCompare.md
Normal file
22
docs/api/namespaces/Utils/functions/deepCompare.md
Normal 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)
|
||||
17
docs/api/namespaces/Utils/functions/escapeStringRegexp.md
Normal file
17
docs/api/namespaces/Utils/functions/escapeStringRegexp.md
Normal 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)
|
||||
30
docs/api/namespaces/Utils/functions/findFunction.md
Normal file
30
docs/api/namespaces/Utils/functions/findFunction.md
Normal 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)
|
||||
19
docs/api/namespaces/Utils/functions/generateRandomString.md
Normal file
19
docs/api/namespaces/Utils/functions/generateRandomString.md
Normal 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)
|
||||
21
docs/api/namespaces/Utils/functions/generateSidAuth.md
Normal file
21
docs/api/namespaces/Utils/functions/generateSidAuth.md
Normal 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)
|
||||
21
docs/api/namespaces/Utils/functions/getCookie.md
Normal file
21
docs/api/namespaces/Utils/functions/getCookie.md
Normal 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)
|
||||
21
docs/api/namespaces/Utils/functions/getRandomUserAgent.md
Normal file
21
docs/api/namespaces/Utils/functions/getRandomUserAgent.md
Normal 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)
|
||||
@@ -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)
|
||||
25
docs/api/namespaces/Utils/functions/hasKeys.md
Normal file
25
docs/api/namespaces/Utils/functions/hasKeys.md
Normal 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)
|
||||
17
docs/api/namespaces/Utils/functions/isTextRun.md
Normal file
17
docs/api/namespaces/Utils/functions/isTextRun.md
Normal 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)
|
||||
17
docs/api/namespaces/Utils/functions/streamToIterable.md
Normal file
17
docs/api/namespaces/Utils/functions/streamToIterable.md
Normal 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)
|
||||
17
docs/api/namespaces/Utils/functions/throwIfMissing.md
Normal file
17
docs/api/namespaces/Utils/functions/throwIfMissing.md
Normal 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)
|
||||
21
docs/api/namespaces/Utils/functions/timeToSeconds.md
Normal file
21
docs/api/namespaces/Utils/functions/timeToSeconds.md
Normal 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)
|
||||
17
docs/api/namespaces/Utils/functions/u8ToBase64.md
Normal file
17
docs/api/namespaces/Utils/functions/u8ToBase64.md
Normal 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)
|
||||
Reference in New Issue
Block a user