YTMusic class

Allows automated interactions with YouTube Music by emulating the YouTube web client's requests.

Permits both authenticated and non-authenticated requests. Authentication header data must be provided on initialization.

Inheritance
Mixed-in types

Properties

authType AuthType
Get the authentication type.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headers Future<Map<String, String>>
Headers property for requests.
no setterinherited
parser Parser
Get the i18n parser.
getter/setter pairinherited
proxy Uri?
Get the proxy configuration.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addPlaylistItems(String playlistId, {List<String>? videoIds, String? sourcePlaylist, bool duplicates = false}) Future
Add songs to an existing playlist.
inherited
asMobile<T>(Future<T> callback()) Future<T>
Set client temporary as YouTube Music Mobile app for sending request.
inherited
checkAuth() → void
Checks if the user has provided authorization credentials.
inherited
close({bool force = true}) → void
Closes the session.
inherited
createPlaylist(String title, String description, {String privacyStatus = 'PRIVATE', List<String>? videoIds, String? sourcePlaylist}) Future
Creates a new empty playlist and returns its id.
inherited
deletePlaylist(String playlistId) Future
Delete a playlist.
inherited
editPlaylist(String playlistId, {String? title, String? description, String? privacyStatus, dynamic moveItem, String? addPlaylistId, bool? addToTop}) Future
Edit title, description or privacyStatus of a playlist.
inherited
getAlbum(String browseId, {JsonMap? requestData}) Future<JsonMap>
Get information and tracks of an album.
inherited
getAlbumBrowseId(String audioPlaylistId) Future<String?>
Get an album's browseId based on its audioPlaylistId.
inherited
getArtist(String channelId) Future<JsonMap>
Get information about an artist and their top releases (songs, albums, singles, videos, and related artists).
inherited
getArtistAlbums(String channelId, String params, {int? limit = 100, ArtistOrderType? order}) Future<List>
Get the full list of an artist's albums, singles or shows.
inherited
getBaseJsUrl() Future<String>
Extract the URL for the base.js script from YouTube Music.
inherited
getChannel(String channelId) Future<JsonMap>
Get information about a podcast channel (episodes, podcasts).
inherited
getChannelEpisodes(String channelId, String params) Future<List>
Get all channel episodes. This endpoint is currently unlimited.
inherited
getCharts({String country = 'ZZ'}) Future<JsonMap>
Get latest charts data from YouTube Music: Artists and playlists of top videos.
inherited
getEpisode(String videoId) Future<JsonMap>
Retrieve episode data for a single episode.
inherited
getEpisodesPlaylist({String playlistId = 'RDPN'}) Future<JsonMap>
Get all episodes in an episodes playlist.
inherited
getExplore() Future<JsonMap>
Get latest explore data from YouTube Music.
inherited
getHome({int limit = 3}) Future<List>
Get the home page.
inherited
getLikedSongs({int limit = 100}) Future<JsonMap>
Gets playlist items for the 'Liked Songs' playlist.
inherited
getLyrics(String browseId, {bool timestamps = false}) Future<JsonMap?>
Returns lyrics of a song or video. When timestamps is set, lyrics are returned with timestamps, if available.
inherited
getMoodCategories() Future<JsonMap>
Fetch "Moods & Genres" categories from YouTube Music.
inherited
getMoodPlaylists(String params) Future<List>
Retrieve a list of playlists for a given "Moods & Genres" category.
inherited
getPlaylist(String playlistId, {int? limit = 100, bool related = false, int suggestionsLimit = 0}) Future<JsonMap>
Returns a list of playlist items.
inherited
getPodcast(String playlistId, {int? limit = 100}) Future<JsonMap>
Returns podcast metadata and episodes.
inherited
getSavedEpisodes({int limit = 100}) Future<JsonMap>
Gets playlist items for the 'Liked Songs' playlist.
inherited
getSearchSuggestions(String query, {bool detailedRuns = false}) Future
Get search suggestions.
inherited
getSignatureTimestamp({String? url}) Future<int>
Fetch the base.js script from YouTube Music and parse out the signatureTimestamp for use with getSong.
inherited
getSong(String videoId, {int? signatureTimestamp}) Future<JsonMap>
Returns metadata and streaming information about a song or video.
inherited
getSongRelated(String browseId) Future<List>
Gets related content for a song. Equivalent to the content shown in the "Related" tab of the watch panel.
inherited
getTasteProfile() Future<JsonMap>
Fetches suggested artists from taste profile (music.youtube.com/tasteprofile). Must be authenticated.
inherited
getUser(String channelId) Future<JsonMap>
Retrieve a user's page. A user may own videos or playlists.
inherited
getUserPlaylists(String channelId, String params) Future<List>
Retrieve a list of playlists for a given user.
inherited
getUserVideos(String channelId, String params) Future<List>
Retrieve a list of videos for a given user.
inherited
getWatchPlaylist({String? videoId, String? playlistId, int limit = 25, bool radio = false, bool shuffle = false}) Future<JsonMap>
Get a watch list of tracks. This watch playlist appears when you press play on a track in YouTube Music.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removePlaylistItems(String playlistId, List<JsonMap> videos) Future
Remove songs from an existing playlist.
inherited
removeSearchSuggestions(List<JsonMap> suggestions, {List<int>? indices}) Future<bool>
Remove search suggestion from the user search history.
inherited
Search YouTube music.
inherited
sendGetRequest(String url, {JsonMap? params, bool useBaseHeaders = false}) Future<Response>
Send a GET request to YouTube Music.
inherited
sendRequest(String endpoint, JsonMap body, {String additionalParams = ''}) Future<JsonMap>
Send a POST request to YouTube Music.
inherited
setTasteProfile(List<String> artists, {JsonMap? tasteProfile}) Future<void>
Favorites artists to see more recommendations from the artist.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create({dynamic auth, String? user, Dio? requestsSession, Uri? proxy, String language = 'en', String location = '', OAuthCredentials? oauthCredentials}) Future<YTMusic>
Create a new instance to interact with YouTube Music.