feat(Music): add automix support and other minor improvements (#184)

* dev(NavigationEndpoint): add `/player` endpoint

* dev: add AudioOnlyPlayability, BrowserMediaSession and MusicDownloadStateBadge

* dev: allow endpoints to be overridden

* dev: minor parser changes

* dev(TrackInfo): add `<info>#getTab(title?)`

* dev: allow `Music#getInfo()` to accept list items

* dev: revert a few changes, I probably overcomplicated this.

* dev: add tests

* dev: add `TrackInfo#getUpNext()`, `TrackInfo#getRelated()` and `TrackInfo#getLyrics()`

* docs: update API ref

* fix(docs): formatting inconsistencies
This commit is contained in:
LuanRT
2022-09-13 02:26:13 -03:00
committed by GitHub
parent 3a7da21fd1
commit f2f48af1bc
16 changed files with 395 additions and 106 deletions

View File

@@ -5,7 +5,7 @@ YouTube Music class.
## API
* Music
* [.getInfo(video_id)](#getinfo)
* [.getInfo(target)](#getinfo)
* [.search(query, filters?)](#search)
* [.getHomeFeed()](#gethomefeed)
* [.getExplore()](#getexplore)
@@ -14,13 +14,13 @@ YouTube Music class.
* [.getAlbum(album_id)](#getalbum)
* [.getPlaylist(playlist_id)](#getplaylist)
* [.getLyrics(video_id)](#getlyrics)
* [.getUpNext(video_id)](#getupnext)
* [.getUpNext(video_id, automix?)](#getupnext)
* [.getRelated(video_id)](#getrelated)
* [.getRecap()](#getrecap)
* [.getSearchSuggestions(query)](#getsearchsuggestions)
<a name="getinfo"></a>
### getInfo(video_id)
### getInfo(target)
Retrieves track info.
@@ -28,7 +28,29 @@ Retrieves track info.
| Param | Type | Description |
| --- | --- | --- |
| video_id | `string` | Video id |
| target | `string` or `MusicTwoRowItem` | video id or list item |
<details>
<summary>Methods & Getters</summary>
<p>
- `<info>#getTab(title)`
- Retrieves contents of the given tab.
- `<info>#getUpNext(automix?)`
- Retrieves up next.
- `<info>#getRelated()`
- Retrieves related content.
- `<info>#getLyrics()`
- Retrieves song lyrics.
- `<info>#available_tabs`
- Returns available tabs.
</p>
</details>
<a name="search"></a>
### search(query, filters?)
@@ -211,14 +233,14 @@ Retrieves given playlist.
Retrieves song lyrics.
**Returns:** `Promise.<{ text: string; footer: object; }>`
**Returns:** `Promise.<MusicDescriptionShelf | undefined>`
| Param | Type | Description |
| --- | --- | --- |
| video_id | `string` | Video id |
<a name="getupnext"></a>
### getUpNext(video_id)
### getUpNext(video_id, automix?)
Retrieves up next content.
@@ -227,6 +249,7 @@ Retrieves up next content.
| Param | Type | Description |
| --- | --- | --- |
| video_id | `string` | Video id |
| automix? | `boolean` | if automix should be fetched |
<a name="getrelated"></a>
### getRelated(video_id)