This allows us to expose the types from the InnerTube class as there is another interface there named `SearchFilters`
7.1 KiB
YouTube Music
YouTube Music is a music streaming service developed by YouTube, a subsidiary of Google. It provides a tailored interface for the service oriented towards music streaming, with a greater emphasis on browsing and discovery compared to its main service. This class allows you to interact with its API.
API
- Music
getInfo(target)
Retrieves track info.
Returns: Promise.<TrackInfo>
| Param | Type | Description |
|---|---|---|
| target | string or MusicTwoRowItem |
video id or list item |
Methods & Getters
-
<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.
-
<info>#toDash(url_transformer?, format_filter?)- Generates a DASH manifest from the streaming data.
-
<info>#chooseFormat(options)- Selects the format that best matches the given options. This method is used internally by
#download.
- Selects the format that best matches the given options. This method is used internally by
-
<info>#download(options?)- Downloads the track.
-
<info>#addToWatchHistory()- Adds the song to the watch history.
-
<info>#page- Returns the original InnerTube response(s), parsed and sanitized.
search(query, filters?)
Searches on YouTube Music.
Returns: Promise.<Search>
| Param | Type | Description |
|---|---|---|
| query | string |
Search query |
| filters? | MusicSearchFilters |
Search filters |
Search Filters
| Filter | Type | Value | Description |
|---|---|---|---|
| type | string |
all, song, video, album, playlist, artist |
Search type |
Methods & Getters
-
<search>#getMore(shelf)- Equivalent to clicking on the shelf to load more items.
-
<search>#getContinuation()- Retrieves continuation, only works for individual sections or filtered results.
-
<search>#selectFilter(name)- Applies given filter to the search.
-
<search>#has_continuation- Checks if continuation is available.
-
<search>#filters- Returns available filters.
-
<search>#songs- Returns songs shelf.
-
<search>#videos- Returns videos shelf.
-
<search>#albums- Returns albums shelf.
-
<search>#artists- Returns artists shelf.
-
<search>#playlists- Returns songs shelf.
-
<search>#page- Returns the original InnerTube response(s), parsed and sanitized.
getHomeFeed()
Retrieves home feed.
Returns: Promise.<HomeFeed>
Methods & Getters
-
<homefeed>#getContinuation()- Retrieves continuation, only works for individual sections or filtered results.
-
<homefeed>#has_continuation- Checks if continuation is available.
-
<homefeed>#page- Returns original InnerTube response (sanitized).
-
<homefeed>#page- Returns the original InnerTube response(s), parsed and sanitized.
getExplore()
Retrieves “Explore” feed.
Returns: Promise.<Explore>
Methods & Getters
<explore>#page- Returns the original InnerTube response(s), parsed and sanitized.
getLibrary()
Retrieves library.
Returns: Library
Methods & Getters
-
<library>#applyFilter(filter)- Applies given filter to the library.
-
<library>#applySort(sort_by)- Applies given sort option to the library items.
-
<library>#getContinuation()- Retrieves continuation of the library items.
-
<library>#has_continuation- Checks if continuation is available.
-
<library>#filters- Returns available filters.
-
<library>#sort_options- Returns available sort options.
-
<library>#page- Returns the original InnerTube response(s), parsed and sanitized.
getArtist(artist_id)
Retrieves artist's info & content.
Returns: Promise.<Artist>
| Param | Type | Description |
|---|---|---|
| artist_id | string |
Artist id |
Methods & Getters
<artist>#page- Returns the original InnerTube response(s), parsed and sanitized.
getAlbum(album_id)
Retrieves given album.
Returns: Promise.<Album>
| Param | Type | Description |
|---|---|---|
| album_id | string |
Album id |
Methods & Getters
<album>#page- Returns the original InnerTube response(s), parsed and sanitized.
getPlaylist(playlist_id)
Retrieves given playlist.
Returns: Promise.<Playlist>
| Param | Type | Description |
|---|---|---|
| playlist_id | string |
Playlist id |
Methods & Getters
-
<playlist>#getRelated()- Retrieves related playlists.
-
<playlist>#getSuggestions()- Retrieves playlist suggestions.
-
<playlist>#getContinuation()- Retrieves continuation.
-
<playlist>#has_continuation- Checks if continuation is available.
-
<playlist>#page- Returns the original InnerTube response(s), parsed and sanitized.
getLyrics(video_id)
Retrieves song lyrics.
Returns: Promise.<MusicDescriptionShelf | undefined>
| Param | Type | Description |
|---|---|---|
| video_id | string |
Video id |
getUpNext(video_id, automix?)
Retrieves up next content.
Returns: Promise.<PlaylistPanel>
| Param | Type | Description |
|---|---|---|
| video_id | string |
Video id |
| automix? | boolean |
if automix should be fetched |
getRelated(video_id)
Retrieves related content.
Returns: Promise.<Array.<MusicCarouselShelf | MusicDescriptionShelf>>
| Param | Type | Description |
|---|---|---|
| video_id | string |
Video id |
getRecap()
Retrieves your YouTube Music recap.
Returns: Promise.<Recap>
Methods & Getters
-
<recap>#getPlaylist()- Retrieves recap playlist.
-
<recap>#page- Returns the original InnerTube response(s), parsed and sanitized.
getSearchSuggestions(query)
Retrieves search suggestions.
Returns: Promise.<Array.<SearchSuggestion | HistorySuggestion>>
| Param | Type | Description |
|---|---|---|
| query | string |
Search query |