ytmusicapi.parsers package
Submodules
ytmusicapi.parsers.albums module
- ytmusicapi.parsers.albums.parse_album_header(response: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.albums.parse_album_header_2024(response: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.albums.parse_album_playlistid_if_exists(data: dict[str, Any] | None) str | None
the content of the data changes based on whether the user is authenticated or not
- Return type:
Optional[str]
ytmusicapi.parsers.artists module
- ytmusicapi.parsers.artists.parse_artists_runs(runs: list[dict[str, Any]]) list[dict[str, Any]]
Returns artist names and IDs. Skips every other run to avoid separators.
- Return type:
list[dict[str,Any]]
ytmusicapi.parsers.browsing module
- ytmusicapi.parsers.browsing.parse_album(result: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.browsing.parse_content_list(results: list[dict[str, Any]], parse_func: collections.abc.Callable[[dict[str, Any]], dict[str, Any]], key: str = 'musicTwoRowItemRenderer') list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.browsing.parse_mixed_content(rows: list[dict[str, Any]]) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.browsing.parse_playlist(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.browsing.parse_single(result: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.browsing.parse_song(result: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.browsing.parse_song_flat(data: dict[str, Any], with_playlist_id: bool = False) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.browsing.parse_video(result: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.browsing.parse_watch_playlist(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
ytmusicapi.parsers.constants module
ytmusicapi.parsers.explore module
- ytmusicapi.parsers.explore.parse_chart_artist(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.explore.parse_chart_episode(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.explore.parse_chart_playlist(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.explore.parse_chart_song(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.explore.parse_ranking(data: dict[str, Any], none_if_absent: Literal[True, False]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.explore.parse_trending_item(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
ytmusicapi.parsers.i18n module
- class ytmusicapi.parsers.i18n.Parser(language: gettext.GNUTranslations) None
Bases:
object- get_api_result_types() list[str]
- Return type:
list[str]
- get_search_result_types() list[str]
- Return type:
list[str]
- get_song_credit_section_map() dict[str, Any]
- Return type:
dict[str,Any]
- parse_channel_contents(results: list[dict[str, Any]]) dict[str, Any]
- Return type:
dict[str,Any]
ytmusicapi.parsers.library module
- ytmusicapi.parsers.library.get_library_contents(response: dict[str, Any], renderer: list[str]) dict[str, Any] | None
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:
dict[str,Any] :param response: ytmusicapi response :type renderer:list[str] :param renderer: GRID or MUSIC_SHELF :rtype:Optional[dict[str,Any]] :return: library contents or None
- ytmusicapi.parsers.library.parse_albums(results: list[dict[str, Any]]) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.library.parse_artists(results: list[dict[str, Any]], uploaded: bool = False) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.library.parse_library_albums(response: dict[str, Any], request_func: collections.abc.Callable[[str], dict[str, Any]], limit: int | None) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.library.parse_library_artists(response: dict[str, Any], request_func: collections.abc.Callable[[str], dict[str, Any]], limit: int | None) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.library.parse_library_podcasts(response: dict[str, Any], request_func: collections.abc.Callable[[str], dict[str, Any]], limit: int | None) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.library.parse_library_songs(response: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.library.pop_songs_random_mix(results: dict[str, Any] | None) 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[str, Any], limit: int | None, request_func: collections.abc.Callable[[dict[str, Any]], dict[str, Any]]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.playlists.parse_playlist_header(response: dict[str, Any]) 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[str, Any], is_album: bool = False, is_collaborative: bool = False) dict[str, Any] | None
- Return type:
Optional[dict[str,Any]]
- ytmusicapi.parsers.playlists.parse_playlist_items(results: list[dict[str, Any]], is_album: bool = False, is_collaborative: bool = False) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.playlists.validate_playlist_id(playlistId: str) str
- Return type:
str
ytmusicapi.parsers.podcasts module
- class ytmusicapi.parsers.podcasts.Description(*args: Any, **kwargs: Any)
Bases:
list[DescriptionElement]- classmethod from_runs(description_runs: list[dict[str, Any]]) ytmusicapi.parsers.podcasts.Description
parse the description runs into a usable format
- Parameters:
description_runs (
list[dict[str,Any]]) – the original description runs- Return type:
- Returns:
List of text (str), timestamp (int) and link values (Link object)
- property text: str
- class ytmusicapi.parsers.podcasts.Link(text: str, url: str) None
Bases:
DescriptionElement-
url:
str
-
url:
- class ytmusicapi.parsers.podcasts.Timestamp(text: str, seconds: int) None
Bases:
DescriptionElement-
seconds:
int
-
seconds:
- ytmusicapi.parsers.podcasts.parse_base_header(header: dict[str, Any]) dict[str, Any]
parse common left hand side (header) items of an episode or podcast page
- Return type:
dict[str,Any]
- ytmusicapi.parsers.podcasts.parse_episode(data: dict[str, Any]) dict[str, Any]
Parses a single episode under “Episodes” on a channel page or on a podcast page
- Return type:
dict[str,Any]
- ytmusicapi.parsers.podcasts.parse_episode_flat(data: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.podcasts.parse_episode_header(header: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.podcasts.parse_podcast(data: dict[str, Any]) dict[str, Any]
Parses a single podcast under “Podcasts” on a channel page
- Return type:
dict[str,Any]
- ytmusicapi.parsers.podcasts.parse_podcast_header(header: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
ytmusicapi.parsers.search module
- ytmusicapi.parsers.search.get_search_params(filter: str | None, scope: str | None, ignore_spelling: bool) str | None
Get search params for search query string based on user input
- Parameters:
filter (
Optional[str]) – The search filterscope (
Optional[str]) – The search scopeignore_spelling (
bool) – If spelling shall be ignored
- Return type:
Optional[str]- Returns:
search param string
- ytmusicapi.parsers.search.get_search_result_type(result_type_local: str, result_types_local: list[str]) str | None
- Return type:
Optional[str]
- ytmusicapi.parsers.search.parse_search_result(data: dict[str, Any], result_type: str | None, category: str | None) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.search.parse_search_results(results: list[dict[str, Any]], resultType: str | None = None, category: str | None = None) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- ytmusicapi.parsers.search.parse_search_suggestions(results: dict[str, Any], detailed_runs: bool) list[str] | list[dict[str, Any]]
- Return type:
list[str] |list[dict[str,Any]]
- ytmusicapi.parsers.search.parse_top_result(data: dict[str, Any], search_result_types: list[str]) dict[str, Any]
- Return type:
dict[str,Any]
ytmusicapi.parsers.songs module
- ytmusicapi.parsers.songs.parse_like_status(service: dict[str, Any]) str
- Return type:
str
- ytmusicapi.parsers.songs.parse_song_album(data: dict[str, Any], index: int) dict[str, Any] | None
- Return type:
Optional[dict[str,Any]]
- ytmusicapi.parsers.songs.parse_song_artists(data: dict[str, Any], index: int) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
- Return type:
dict[str,Any]- Returns:
Dictionary with data from the provided song’s context menu.
Example:
{ "inLibrary": true, "feedbackTokens": { "add": "...", "remove": "..." }, "pinnedToListenAgain": true, "listenAgainFeedbackTokens": { "pin": "...", "unpin": "..." } }
- ytmusicapi.parsers.songs.parse_song_run(run: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]
- ytmusicapi.parsers.songs.parse_song_runs(runs: list[dict[str, Any]], skip_type_spec: bool = False) dict[str, Any]
- Parameters:
skip_type_spec (
bool) – if true, skip the type specifier (like “Song”, “Single”, or “Album”) that may appear before artists (“Song • Eminem”). Otherwise, that text item is parsed as an artist with no ID.- Return type:
dict[str,Any]
ytmusicapi.parsers.uploads module
- ytmusicapi.parsers.uploads.parse_uploaded_items(results: list[dict[str, Any]]) list[dict[str, Any]]
- Return type:
list[dict[str,Any]]
ytmusicapi.parsers.watch module
- ytmusicapi.parsers.watch.get_tab_browse_id(watchNextRenderer: dict[str, Any], tab_id: int) str | None
- Return type:
Optional[str]
- 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: dict[str, Any]) dict[str, Any]
- Return type:
dict[str,Any]