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,128 @@
[youtubei.js](../../../README.md) / [Clients](../README.md) / Kids
# Class: Kids
## Constructors
### new Kids()
> **new Kids**(`session`): [`Kids`](Kids.md)
#### Parameters
**session**: [`Session`](../../../classes/Session.md)
#### Returns
[`Kids`](Kids.md)
#### Defined in
[src/core/clients/Kids.ts:18](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Kids.ts#L18)
## Methods
### blockChannel()
> **blockChannel**(`channel_id`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)[]\>
Retrieves the list of supervised accounts that the signed-in user has
access to, and blocks the given channel for each of them.
#### Parameters
**channel\_id**: `string`
The channel id to block.
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)[]\>
A list of API responses.
#### Defined in
[src/core/clients/Kids.ts:91](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Kids.ts#L91)
***
### getChannel()
> **getChannel**(`channel_id`): `Promise`\<[`Channel`](../../YTKids/classes/Channel.md)\>
Retrieves the contents of the given channel.
#### Parameters
**channel\_id**: `string`
The channel id.
#### Returns
`Promise`\<[`Channel`](../../YTKids/classes/Channel.md)\>
#### Defined in
[src/core/clients/Kids.ts:62](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Kids.ts#L62)
***
### getHomeFeed()
> **getHomeFeed**(): `Promise`\<[`HomeFeed`](../../YTKids/classes/HomeFeed.md)\>
Retrieves the home feed.
#### Returns
`Promise`\<[`HomeFeed`](../../YTKids/classes/HomeFeed.md)\>
#### Defined in
[src/core/clients/Kids.ts:75](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Kids.ts#L75)
***
### getInfo()
> **getInfo**(`video_id`): `Promise`\<[`VideoInfo`](../../YTKids/classes/VideoInfo.md)\>
Retrieves video info.
#### Parameters
**video\_id**: `string`
The video id.
#### Returns
`Promise`\<[`VideoInfo`](../../YTKids/classes/VideoInfo.md)\>
#### Defined in
[src/core/clients/Kids.ts:37](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Kids.ts#L37)
***
### search()
> **search**(`query`): `Promise`\<[`Search`](../../YTKids/classes/Search.md)\>
Searches the given query.
#### Parameters
**query**: `string`
The query.
#### Returns
`Promise`\<[`Search`](../../YTKids/classes/Search.md)\>
#### Defined in
[src/core/clients/Kids.ts:26](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Kids.ts#L26)

View File

@@ -0,0 +1,291 @@
[youtubei.js](../../../README.md) / [Clients](../README.md) / Music
# Class: Music
## Constructors
### new Music()
> **new Music**(`session`): [`Music`](Music.md)
#### Parameters
**session**: [`Session`](../../../classes/Session.md)
#### Returns
[`Music`](Music.md)
#### Defined in
[src/core/clients/Music.ts:40](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L40)
## Methods
### getAlbum()
> **getAlbum**(`album_id`): `Promise`\<[`Album`](../../YTMusic/classes/Album.md)\>
Retrieves album.
#### Parameters
**album\_id**: `string`
The album id.
#### Returns
`Promise`\<[`Album`](../../YTMusic/classes/Album.md)\>
#### Defined in
[src/core/clients/Music.ts:209](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L209)
***
### getArtist()
> **getArtist**(`artist_id`): `Promise`\<[`Artist`](../../YTMusic/classes/Artist.md)\>
Retrieves artist's info & content.
#### Parameters
**artist\_id**: `string`
The artist id.
#### Returns
`Promise`\<[`Artist`](../../YTMusic/classes/Artist.md)\>
#### Defined in
[src/core/clients/Music.ts:189](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L189)
***
### getExplore()
> **getExplore**(): `Promise`\<[`Explore`](../../YTMusic/classes/Explore.md)\>
Retrieves the Explore feed.
#### Returns
`Promise`\<[`Explore`](../../YTMusic/classes/Explore.md)\>
#### Defined in
[src/core/clients/Music.ts:159](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L159)
***
### getHomeFeed()
> **getHomeFeed**(): `Promise`\<[`HomeFeed`](../../YTMusic/classes/HomeFeed.md)\>
Retrieves the home feed.
#### Returns
`Promise`\<[`HomeFeed`](../../YTMusic/classes/HomeFeed.md)\>
#### Defined in
[src/core/clients/Music.ts:145](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L145)
***
### getInfo()
> **getInfo**(`target`): `Promise`\<[`TrackInfo`](../../YTMusic/classes/TrackInfo.md)\>
Retrieves track info. Passing a list item of type MusicTwoRowItem automatically starts a radio.
#### Parameters
**target**: `string` \| [`NavigationEndpoint`](../../YTNodes/classes/NavigationEndpoint.md) \| [`MusicResponsiveListItem`](../../YTNodes/classes/MusicResponsiveListItem.md) \| [`MusicTwoRowItem`](../../YTNodes/classes/MusicTwoRowItem.md)
Video id or a list item.
#### Returns
`Promise`\<[`TrackInfo`](../../YTMusic/classes/TrackInfo.md)\>
#### Defined in
[src/core/clients/Music.ts:49](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L49)
***
### getLibrary()
> **getLibrary**(): `Promise`\<[`Library`](../../YTMusic/classes/Library.md)\>
Retrieves the library.
#### Returns
`Promise`\<[`Library`](../../YTMusic/classes/Library.md)\>
#### Defined in
[src/core/clients/Music.ts:174](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L174)
***
### getLyrics()
> **getLyrics**(`video_id`): `Promise`\<`undefined` \| [`MusicDescriptionShelf`](../../YTNodes/classes/MusicDescriptionShelf.md)\>
Retrieves song lyrics.
#### Parameters
**video\_id**: `string`
The video id.
#### Returns
`Promise`\<`undefined` \| [`MusicDescriptionShelf`](../../YTNodes/classes/MusicDescriptionShelf.md)\>
#### Defined in
[src/core/clients/Music.ts:325](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L325)
***
### getPlaylist()
> **getPlaylist**(`playlist_id`): `Promise`\<[`Playlist`](../../YTMusic/classes/Playlist.md)\>
Retrieves playlist.
#### Parameters
**playlist\_id**: `string`
The playlist id.
#### Returns
`Promise`\<[`Playlist`](../../YTMusic/classes/Playlist.md)\>
#### Defined in
[src/core/clients/Music.ts:229](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L229)
***
### getRecap()
> **getRecap**(): `Promise`\<[`Recap`](../../YTMusic/classes/Recap.md)\>
Retrieves recap.
#### Returns
`Promise`\<[`Recap`](../../YTMusic/classes/Recap.md)\>
#### Defined in
[src/core/clients/Music.ts:355](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L355)
***
### getRelated()
> **getRelated**(`video_id`): `Promise`\<[`SectionList`](../../YTNodes/classes/SectionList.md) \| [`Message`](../../YTNodes/classes/Message.md)\>
Retrieves related content.
#### Parameters
**video\_id**: `string`
The video id.
#### Returns
`Promise`\<[`SectionList`](../../YTNodes/classes/SectionList.md) \| [`Message`](../../YTNodes/classes/Message.md)\>
#### Defined in
[src/core/clients/Music.ts:297](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L297)
***
### getSearchSuggestions()
> **getSearchSuggestions**(`query`): `Promise`\<[`ObservedArray`](../../Helpers/type-aliases/ObservedArray.md)\<[`SearchSuggestionsSection`](../../YTNodes/classes/SearchSuggestionsSection.md)\>\>
Retrieves search suggestions for the given query.
#### Parameters
**query**: `string`
The query.
#### Returns
`Promise`\<[`ObservedArray`](../../Helpers/type-aliases/ObservedArray.md)\<[`SearchSuggestionsSection`](../../YTNodes/classes/SearchSuggestionsSection.md)\>\>
#### Defined in
[src/core/clients/Music.ts:370](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L370)
***
### getUpNext()
> **getUpNext**(`video_id`, `automix`): `Promise`\<[`PlaylistPanel`](../../YTNodes/classes/PlaylistPanel.md)\>
Retrieves up next.
#### Parameters
**video\_id**: `string`
The video id.
**automix**: `boolean` = `true`
Whether to enable automix.
#### Returns
`Promise`\<[`PlaylistPanel`](../../YTNodes/classes/PlaylistPanel.md)\>
#### Defined in
[src/core/clients/Music.ts:251](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L251)
***
### search()
> **search**(`query`, `filters`): `Promise`\<[`Search`](../../YTMusic/classes/Search.md)\>
Searches on YouTube Music.
#### Parameters
**query**: `string`
Search query.
**filters**: [`MusicSearchFilters`](../../Types/type-aliases/MusicSearchFilters.md) = `{}`
Search filters.
#### Returns
`Promise`\<[`Search`](../../YTMusic/classes/Search.md)\>
#### Defined in
[src/core/clients/Music.ts:116](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Music.ts#L116)

View File

@@ -0,0 +1,89 @@
[youtubei.js](../../../README.md) / [Clients](../README.md) / Studio
# Class: Studio
## Constructors
### new Studio()
> **new Studio**(`session`): [`Studio`](Studio.md)
#### Parameters
**session**: [`Session`](../../../classes/Session.md)
#### Returns
[`Studio`](Studio.md)
#### Defined in
[src/core/clients/Studio.ts:26](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Studio.ts#L26)
## Methods
### updateVideoMetadata()
> **updateVideoMetadata**(`video_id`, `metadata`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Updates the metadata of a video.
#### Parameters
**video\_id**: `string`
**metadata**: `Partial`\<`object`\>
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Example
```ts
const videoId = 'abcdefg';
const thumbnail = fs.readFileSync('./my_awesome_thumbnail.jpg');
const response = await yt.studio.updateVideoMetadata(videoId, {
tags: [ 'astronomy', 'NASA', 'APOD' ],
title: 'Artemis Mission',
description: 'A nicely written description...',
category: 27,
license: 'creative_commons',
thumbnail,
// ...
});
```
#### Defined in
[src/core/clients/Studio.ts:48](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Studio.ts#L48)
***
### upload()
> **upload**(`file`, `metadata`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Uploads a video to YouTube.
#### Parameters
**file**: `BodyInit`
**metadata**: `Partial`\<`object`\> = `{}`
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Example
```ts
const file = fs.readFileSync('./my_awesome_video.mp4');
const response = await yt.studio.upload(file.buffer, { title: 'Wow!' });
```
#### Defined in
[src/core/clients/Studio.ts:151](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/clients/Studio.ts#L151)