ytmusicapi.parsers package

Submodules

ytmusicapi.parsers.albums module

ytmusicapi.parsers.albums.parse_album_header(response)
ytmusicapi.parsers.albums.parse_album_header_2024(response)

ytmusicapi.parsers.browsing module

ytmusicapi.parsers.browsing.parse_album(result)
ytmusicapi.parsers.browsing.parse_content_list(results, parse_func, key='musicTwoRowItemRenderer')
ytmusicapi.parsers.browsing.parse_mixed_content(rows)
ytmusicapi.parsers.browsing.parse_playlist(data)
ytmusicapi.parsers.browsing.parse_single(result)
ytmusicapi.parsers.browsing.parse_song(result)
ytmusicapi.parsers.browsing.parse_song_flat(data)
ytmusicapi.parsers.browsing.parse_video(result)
ytmusicapi.parsers.browsing.parse_watch_playlist(data)

ytmusicapi.parsers.explore module

ytmusicapi.parsers.explore.parse_chart_artist(data)
ytmusicapi.parsers.explore.parse_chart_song(data)
ytmusicapi.parsers.explore.parse_ranking(data)

ytmusicapi.parsers.i18n module

class ytmusicapi.parsers.i18n.Parser(language)

Bases: object

get_api_result_types()
get_search_result_types()
parse_channel_contents(results: list) dict
Return type:

dict

ytmusicapi.parsers.library module

ytmusicapi.parsers.library.get_library_contents(response, renderer)

Find library contents. This function is a bit messy now as it is supporting two different response types. Can be cleaned up once all users are migrated to the new responses. :type response: :param response: ytmusicapi response :type renderer: :param renderer: GRID or MUSIC_SHELF :return: library contents or None

ytmusicapi.parsers.library.parse_albums(results)
ytmusicapi.parsers.library.parse_artists(results, uploaded=False)
ytmusicapi.parsers.library.parse_library_albums(response, request_func, limit)
ytmusicapi.parsers.library.parse_library_artists(response, request_func, limit)
ytmusicapi.parsers.library.parse_library_podcasts(response, request_func, limit)
ytmusicapi.parsers.library.parse_library_songs(response)
ytmusicapi.parsers.library.pop_songs_random_mix(results) None

remove the random mix that conditionally appears at the start of library songs

Return type:

None

ytmusicapi.parsers.playlists module

ytmusicapi.parsers.playlists.parse_audio_playlist(response: dict, limit: int | None, request_func) dict[str, Any]
Return type:

dict[str, Any]

ytmusicapi.parsers.playlists.parse_playlist_header(response: dict) dict[str, Any]
Return type:

dict[str, Any]

ytmusicapi.parsers.playlists.parse_playlist_header_meta(header: dict[str, Any]) dict[str, Any]
Return type:

dict[str, Any]

ytmusicapi.parsers.playlists.parse_playlist_item(data: dict, menu_entries: list[list] | None = None, is_album=False) dict | None
Return type:

Optional[dict]

ytmusicapi.parsers.playlists.parse_playlist_items(results, menu_entries: list[list] | None = None, is_album=False)
ytmusicapi.parsers.playlists.validate_playlist_id(playlistId: str) str
Return type:

str

ytmusicapi.parsers.podcasts module

class ytmusicapi.parsers.podcasts.Description(*args, **kwargs)

Bases: list[DescriptionElement]

classmethod from_runs(description_runs: list[dict]) ytmusicapi.parsers.podcasts.Description

parse the description runs into a usable format

Parameters:

description_runs (list[dict]) – the original description runs

Return type:

Description

Returns:

List of text (str), timestamp (int) and link values (Link object)

property text: str
class ytmusicapi.parsers.podcasts.DescriptionElement(text: str) None

Bases: object

text: str

Bases: DescriptionElement

url: str
class ytmusicapi.parsers.podcasts.Timestamp(text: str, seconds: int) None

Bases: DescriptionElement

seconds: int
ytmusicapi.parsers.podcasts.parse_base_header(header: dict) dict

parse common left hand side (header) items of an episode or podcast page

Return type:

dict

ytmusicapi.parsers.podcasts.parse_episode(data)

Parses a single episode under “Episodes” on a channel page or on a podcast page

ytmusicapi.parsers.podcasts.parse_episode_header(header: dict) dict
Return type:

dict

ytmusicapi.parsers.podcasts.parse_podcast(data)

Parses a single podcast under “Podcasts” on a channel page

ytmusicapi.parsers.podcasts.parse_podcast_header(header: dict) dict
Return type:

dict

ytmusicapi.parsers.search module

ytmusicapi.parsers.search.get_search_params(filter, scope, ignore_spelling)
ytmusicapi.parsers.search.get_search_result_type(result_type_local, result_types_local)
ytmusicapi.parsers.search.parse_album_playlistid_if_exists(data: dict[str, Any]) str | None

the content of the data changes based on whether the user is authenticated or not

Return type:

Optional[str]

ytmusicapi.parsers.search.parse_search_result(data, api_search_result_types, result_type, category)
ytmusicapi.parsers.search.parse_search_results(results, api_search_result_types, resultType=None, category=None)
ytmusicapi.parsers.search.parse_search_suggestions(results: dict[str, Any], detailed_runs: bool) list[str] | list[dict[str, Any]]
Return type:

Union[list[str], list[dict[str, Any]]]

ytmusicapi.parsers.search.parse_top_result(data, search_result_types)

ytmusicapi.parsers.songs module

ytmusicapi.parsers.songs.parse_like_status(service)
ytmusicapi.parsers.songs.parse_song_album(data, index)
ytmusicapi.parsers.songs.parse_song_artists(data, index)
ytmusicapi.parsers.songs.parse_song_artists_runs(runs)
ytmusicapi.parsers.songs.parse_song_library_status(item) bool

Returns True if song is in the library

Return type:

bool

ytmusicapi.parsers.songs.parse_song_menu_tokens(item)
ytmusicapi.parsers.songs.parse_song_runs(runs)

ytmusicapi.parsers.uploads module

ytmusicapi.parsers.uploads.parse_uploaded_items(results)

ytmusicapi.parsers.watch module

ytmusicapi.parsers.watch.get_tab_browse_id(watchNextRenderer, tab_id)
ytmusicapi.parsers.watch.parse_watch_playlist(results: list[dict[str, Any]]) list[dict[str, Any]]
Return type:

list[dict[str, Any]]

ytmusicapi.parsers.watch.parse_watch_track(data)

Module contents