Library

Methods

# (async) editSongLibraryStatus(feedbackTokensopt)

Adds or removes a song from your library depending on the token provided.
Parameters:
Name Type Attributes Description
feedbackTokens Array.<string> <optional>
List of feedbackTokens obtained from authenticated requests to endpoints that return songs (i.e. `get_album`).
Returns:
Full response.

# (async) getHistory()

Gets your play history in reverse chronological order.
Returns:
List of playlistItems, see `getPlaylist`. The additional property ``played`` indicates when the playlistItem was played. The additional property ``feedbackToken`` can be used to remove items with `removeHistoryItems`.

# (async) getLibraryAlbums(options=opt)

Gets the albums in the user's library.
Parameters:
Name Type Attributes Default Description
options= Object <optional>
options.limit number <optional>
25 Number of albums to return.
options.order= lt.Order <optional>
Order of albums to return. Allowed values: 'a_to_z', 'z_to_a', 'recently_added'.
Returns:
List of albums.
Example

Each item is in the following format

{
  "browseId": "MPREb_G8AiyN7RvFg",
  "title": "Beautiful",
  "type": "Album",
  "thumbnails": [...],
  "artists": [{
    "name": "Project 46",
    "id": "UCXFv36m62USAN5rnVct9B4g"
  }],
    "year": "2015"
}

# (async) getLibraryArtists(options=opt)

Gets the artists of the songs in the user's library.
Parameters:
Name Type Attributes Default Description
options= Object <optional>
options.limit number <optional>
25 Number of artists to return.
options.order= lt.Order <optional>
Order of artists to return.
Returns:
List of artists.
Example

Each item is in the following format

{
  "browseId": "UCxEqaQWosMHaTih-tgzDqug",
  "artist": "WildVibes",
  "subscribers": "2.91K",
  "thumbnails": [...]
}

# (async) getLibraryPlaylists(limitopt)

Retrieves the playlists in the user's library.
Parameters:
Name Type Attributes Default Description
limit number <optional>
25 Number of playlists to retrieve.
Returns:
Array of owned playlists.
Example

Each item is in the following format

{
  'playlistId': 'PLQwVIlKxHM6rz0fDJVv_0UlXGEWf-bFys',
  'title': 'Playlist title',
  'thumbnails: [...],
  'count': 5
}

# (async) getLibrarySongs(options=opt)

Gets the songs in the user's library (liked videos are not included). To get liked songs and videos, use `getLikedSongs`.
Parameters:
Name Type Attributes Default Description
options= Object <optional>
options.limit number <optional>
25 Limit number of songs to retrieve.
options.validateResponse boolean <optional>
false Flag indicating if responses from YTM should be validated and retried in case when some songs are missing.
options.order= lt.Order <optional>
Order of songs to return. Allowed values: 'a_to_z', 'z_to_a', 'recently_added'.
Returns:
List of songs. Same format as `getPlaylist`

# (async) getLibrarySubscriptions(options)

Gets the artists the user has subscribed to.
Parameters:
Name Type Description
options
Properties
Name Type Attributes Default Description
limit number <optional>
25 Number of artists to return.
order= lt.Order <optional>
Order of artists to return. Allowed values: 'a_to_z', 'z_to_a', 'recently_added'.
Returns:
List of artists. Same format as `getLibraryArtists`

# (async) getLikedSongs(limitopt)

Gets playlist items for the 'Liked Songs' playlist.
Parameters:
Name Type Attributes Default Description
limit number <optional>
100 How many items to return.
Returns:
List of playlistItem dictionaries. See `getPlaylist`

# (async) ratePlaylist(videoIdopt, ratingopt)

Rates a playlist/album ("Add to library"/"Remove from library" interactions on YouTube Music) You can also dislike a playlist/album, which has an effect on your recommendations
Parameters:
Name Type Attributes Default Description
videoId string <optional>
Playlist id.
rating string <optional>
'INDIFFERENT' One of 'LIKE', 'DISLIKE', 'INDIFFERENT'. 'INDIFFERENT' removes the playlist/album from the library.
Returns:
Full response.

# (async) rateSong(videoIdopt, ratingopt)

Rates a song ("thumbs up"/"thumbs down" interactions on YouTube Music).
Parameters:
Name Type Attributes Default Description
videoId string <optional>
Video id.
rating string <optional>
'INDIFFERENT' One of 'LIKE', 'DISLIKE', 'INDIFFERENT'. 'INDIFFERENT' removes the playlist/album from the library
Returns:
Full response.

# (async) removeHistoryItems(feedbackTokens)

Remove an item from the account's history. This method does currently not work with brand accounts.
Parameters:
Name Type Description
feedbackTokens Token to identify the item to remove, obtained from `getHistory`.
Returns:
Full response.

# (async) subscribeArtists(channelIds)

Subscribe to artists. Adds the artists to your library.
Parameters:
Name Type Description
channelIds Artist channel ids.
Returns:
Full response.

# (async) unsubscribeArtists(channelIds)

Unsubscribe to artists. Removes the artists to your library.
Parameters:
Name Type Description
channelIds Artist channel ids.
Returns:
Full response.