mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-15 18:42:11 +00:00
* dev: add response types * dev: refactor `Parser#parseResponse()` * dev: update YouTube parsers * dev: update YouTube Music classes * dev: update YouTube Kids classes * dev: update core classes * dev(Parser): fix some inconsistencies * chore: update docs * chore: update docs x2 * fix: export response types * chore(docs): update parser example
72 lines
1.8 KiB
Markdown
72 lines
1.8 KiB
Markdown
# PlaylistManager
|
|
|
|
Playlist management class.
|
|
|
|
## API
|
|
|
|
* PlaylistManager
|
|
* [.create(title, video_ids)](#create)
|
|
* [.delete(playlist_id)](#delete)
|
|
* [.addVideos(playlist_id, video_ids)](#addvideos)
|
|
* [.removeVideos(playlist_id, video_ids)](#removevideos)
|
|
* [.moveVideo(playlist_id, moved_video_id, predecessor_video_id)](#movevideo)
|
|
|
|
<a name="create"></a>
|
|
### create(title, video_ids)
|
|
|
|
Creates a playlist.
|
|
|
|
**Returns:** `Promise.<ApiResponse>`
|
|
|
|
| Param | Type | Description |
|
|
| --- | --- | --- |
|
|
| title | `string` | Playlist name |
|
|
| video_ids | `string[]` | array of videos |
|
|
|
|
<a name="delete"></a>
|
|
### delete(playlist_id)
|
|
|
|
Deletes given playlist.
|
|
|
|
**Returns:** `Promise.<ApiResponse>`
|
|
|
|
| Param | Type | Description |
|
|
| --- | --- | --- |
|
|
| playlist_id | `string` | Playlist id |
|
|
|
|
<a name="addvideos"></a>
|
|
### addVideos(playlist_id, video_ids)
|
|
|
|
Adds videos to given playlist.
|
|
|
|
**Returns:** `Promise.<{ playlist_id: string; action_result: any[] }>`
|
|
|
|
| Param | Type | Description |
|
|
| --- | --- | --- |
|
|
| playlist_id | `string` | Playlist id |
|
|
| video_ids | `string` | array of videos |
|
|
|
|
<a name="removevideos"></a>
|
|
### removeVideos(playlist_id, video_ids)
|
|
|
|
Removes videos from given playlist.
|
|
|
|
**Returns:** `Promise.<{ playlist_id: string; action_result: any[] }>`
|
|
|
|
| Param | Type | Description |
|
|
| --- | --- | --- |
|
|
| playlist_id | `string` | Playlist id |
|
|
| video_ids | `string` | array of videos |
|
|
|
|
<a name="movevideo"></a>
|
|
### moveVideo(playlist_id, moved_video_id, predecessor_video_id)
|
|
|
|
Moves a video to a new position within a given playlist.
|
|
|
|
**Returns:** `Promise.<{ playlist_id: string; action_result: any[] }>`
|
|
|
|
| Param | Type | Description |
|
|
| --- | --- | --- |
|
|
| playlist_id | `string` | Playlist id |
|
|
| moved_video_id | `string` | the video to be moved |
|
|
| predecessor_video_id | `string` | the video present in the target position | |