diff --git a/README.rst b/README.rst index e01c280..42e534b 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ Features | **Library management**: -* get library contents: playlists, songs, artists, albums and subscriptions +* get library contents: playlists, songs, artists, albums and subscriptions, podcasts, channels * add/remove library content: rate songs, albums and playlists, subscribe/unsubscribe artists * get and modify play history @@ -62,6 +62,7 @@ Features * get podcasts * get episodes +* get channels | **Uploads**: diff --git a/docs/source/reference.rst b/docs/source/reference.rst index bbba18f..056eef6 100644 --- a/docs/source/reference.rst +++ b/docs/source/reference.rst @@ -52,7 +52,10 @@ Library .. automethod:: YTMusic.get_library_albums .. automethod:: YTMusic.get_library_artists .. automethod:: YTMusic.get_library_subscriptions +.. automethod:: YTMusic.get_library_podcasts +.. automethod:: YTMusic.get_library_channels .. automethod:: YTMusic.get_liked_songs +.. automethod:: YTMusic.get_saved_episodes .. automethod:: YTMusic.get_history .. automethod:: YTMusic.add_history_item .. automethod:: YTMusic.remove_history_items @@ -74,6 +77,8 @@ Playlists Podcasts -------- +.. automethod:: YTMusic.get_channel +.. automethod:: YTMusic.get_channel_episodes .. automethod:: YTMusic.get_podcast .. automethod:: YTMusic.get_episode diff --git a/pdm.lock b/pdm.lock index 299f1e6..cf96ce9 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:ab467aa4e09402f8249d103fc719d3dd2f9bab661ea269227b9358a8c223fa6e" +content_hash = "sha256:0685d381623716626cfb292c864b09d36ff40e8d2e7e0a285c97f236aa4d6ddb" [[package]] name = "alabaster" @@ -487,6 +487,17 @@ files = [ {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] +[[package]] +name = "pycowsay" +version = "0.0.0.2" +requires_python = ">=3.6" +summary = "" +groups = ["default"] +files = [ + {file = "pycowsay-0.0.0.2-py3-none-any.whl", hash = "sha256:5c03d8a9c7666ec102aaed4bbd6c7d35228489ce236f95f6e5d079529c6a5050"}, + {file = "pycowsay-0.0.0.2.tar.gz", hash = "sha256:d112c4ce55b04dbc363c5a8957b80a0dc7459e864866d6e0202d15a95633bcf4"}, +] + [[package]] name = "pygments" version = "2.17.2" @@ -734,6 +745,20 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +[[package]] +name = "types-requests" +version = "2.31.0.20240218" +requires_python = ">=3.8" +summary = "Typing stubs for requests" +groups = ["dev"] +dependencies = [ + "urllib3>=2", +] +files = [ + {file = "types-requests-2.31.0.20240218.tar.gz", hash = "sha256:f1721dba8385958f504a5386240b92de4734e047a08a40751c1654d1ac3349c5"}, + {file = "types_requests-2.31.0.20240218-py3-none-any.whl", hash = "sha256:a82807ec6ddce8f00fe0e949da6d6bc1fbf1715420218a9640d695f70a9e5a9b"}, +] + [[package]] name = "typing-extensions" version = "4.10.0" diff --git a/pyproject.toml b/pyproject.toml index 356ea70..65d424f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,4 +77,5 @@ dev = [ "mypy>=1.8.0", "pytest>=7.4.4", "pytest-cov>=4.1.0", + "types-requests>=2.31.0.20240218", ] diff --git a/tests/mixins/test_library.py b/tests/mixins/test_library.py index b2e6052..c47d2b4 100644 --- a/tests/mixins/test_library.py +++ b/tests/mixins/test_library.py @@ -60,6 +60,20 @@ class TestLibrary: artists = yt_empty.get_library_subscriptions() assert len(artists) == 0 + def test_get_library_podcasts(self, yt_brand, yt_empty): + podcasts = yt_brand.get_library_podcasts(limit=50, order="a_to_z") + assert len(podcasts) > 25 + + empty = yt_empty.get_library_podcasts() + assert len(empty) == 1 # saved episodes playlist is always there + + def test_get_library_channels(self, yt_brand, yt_empty): + channels = yt_brand.get_library_channels(limit=50, order="recently_added") + assert len(channels) > 25 + + empty = yt_empty.get_library_channels() + assert len(empty) == 0 + def test_get_liked_songs(self, yt_brand, yt_empty): songs = yt_brand.get_liked_songs(200) assert len(songs["tracks"]) > 100 diff --git a/tests/mixins/test_podcasts.py b/tests/mixins/test_podcasts.py index b9d6d89..63935fc 100644 --- a/tests/mixins/test_podcasts.py +++ b/tests/mixins/test_podcasts.py @@ -1,13 +1,26 @@ class TestPodcasts: + def test_get_channel(self, config, yt): + podcast_id = config["podcasts"]["channel_id"] + channel = yt.get_channel(podcast_id) + assert len(channel["episodes"]["results"]) == 10 + assert len(channel["podcasts"]["results"]) > 5 + + def test_get_channel_episodes(self, config, yt_oauth): + channel_id = config["podcasts"]["channel_id"] + channel = yt_oauth.get_channel(channel_id) + channel_episodes = yt_oauth.get_channel_episodes(channel_id, channel["episodes"]["params"]) + assert len(channel_episodes) >= 150 + assert len(channel_episodes[0]) == 9 + def test_get_podcast(self, config, yt, yt_brand): podcast_id = config["podcasts"]["podcast_id"] - results = yt.get_podcast(podcast_id) - assert len(results["episodes"]) == 100 - assert not results["saved"] + podcast = yt.get_podcast(podcast_id) + assert len(podcast["episodes"]) == 100 + assert not podcast["saved"] - results = yt_brand.get_podcast(podcast_id, limit=None) - assert len(results["episodes"]) > 100 - assert results["saved"] + podcast = yt_brand.get_podcast(podcast_id, limit=None) + assert len(podcast["episodes"]) > 100 + assert podcast["saved"] def test_many_podcasts(self, yt): results = yt.search("podcast", filter="podcasts") @@ -17,13 +30,13 @@ class TestPodcasts: def test_get_episode(self, config, yt, yt_brand): episode_id = config["podcasts"]["episode_id"] - result = yt.get_episode(episode_id) - assert len(result["description"]) >= 20 - assert not result["saved"] - assert result["playlistId"] is not None + episode = yt.get_episode(episode_id) + assert len(episode["description"]) >= 20 + assert not episode["saved"] + assert episode["playlistId"] is not None - result = yt_brand.get_episode(episode_id) - assert result["saved"] + episode = yt_brand.get_episode(episode_id) + assert episode["saved"] def test_many_episodes(self, yt): results = yt.search("episode", filter="episodes") diff --git a/tests/setup/setup_account.py b/tests/setup/setup_account.py index a00fb54..45000b8 100644 --- a/tests/setup/setup_account.py +++ b/tests/setup/setup_account.py @@ -15,7 +15,7 @@ brand_account = "114511851949139689139" yt_brand = YTMusic(Path(__file__).parent.joinpath("oauth.json").as_posix(), brand_account) -def populate_account(): +def populate_music(): """idempotent requests to populate an account""" # library playlist_id = "RDCLAK5uy_l9ex2d91-Qb1i-W7d0MLCEl_ZjRXss0Dk" # fixed playlist with many artists @@ -53,10 +53,18 @@ def populate_account(): ) print(f"Created playlist {playlistId}, don't forget to set this in test.cfg playlists/own") - # podcasts + +def populate_podcasts(): yt_brand.rate_playlist(config["podcasts"]["podcast_id"], rating="LIKE") yt_brand.add_playlist_items("SE", [config["podcasts"]["episode_id"]]) + podcasts = yt_brand.search("podcast", filter="podcasts", limit=40) + for podcast in podcasts: + playlist_id = podcast["browseId"][4:] + yt_brand.rate_playlist(playlist_id, rating="LIKE") + podcast = yt_brand.get_podcast(playlist_id) + yt_brand.subscribe_artists([podcast["author"]["id"]]) if __name__ == "__main__": - populate_account() + populate_music() + populate_podcasts() diff --git a/tests/test.example.cfg b/tests/test.example.cfg index 0b458c3..2bb79d1 100644 --- a/tests/test.example.cfg +++ b/tests/test.example.cfg @@ -31,6 +31,11 @@ private_album_id = sample_id_of_private_album private_artist_id = sample_id_of_private_artist private_upload_id = sample_video_id_of_private_upload +[podcasts] +channel_id = UCGwuxdEeCf0TIA2RbPOj-8g +podcast_id = PLxq_lXOUlvQDgCVFj9L79kqJybW0k6OaB +episode_id = KNkyHCLOr1o + [limits] library_playlists = 100 library_songs = 200 diff --git a/ytmusicapi/locales/ar/LC_MESSAGES/base.mo b/ytmusicapi/locales/ar/LC_MESSAGES/base.mo index cbbcbde..320d162 100644 Binary files a/ytmusicapi/locales/ar/LC_MESSAGES/base.mo and b/ytmusicapi/locales/ar/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/ar/LC_MESSAGES/base.po b/ytmusicapi/locales/ar/LC_MESSAGES/base.po index 128ad70..0dfa80e 100644 --- a/ytmusicapi/locales/ar/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/ar/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-01-02 22:14+0530\n" "Last-Translator: \n" "Language-Team: \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "فنان" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "قائمةالتشغيل" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "أغنية" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "فيديو" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "محطة" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "الملف الشخصي" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "بودكاست" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "حلقة" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "ألبومات" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "الفردي" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "أشرطة فيديو" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "قوائم التشغيل" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "ذات صلة" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "أحدث الحلقات" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "بودكاست" diff --git a/ytmusicapi/locales/base.pot b/ytmusicapi/locales/base.pot index 50e564b..bb541d1 100644 --- a/ytmusicapi/locales/base.pot +++ b/ytmusicapi/locales/base.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "" diff --git a/ytmusicapi/locales/de/LC_MESSAGES/base.mo b/ytmusicapi/locales/de/LC_MESSAGES/base.mo index 8fb70b5..0b7bb25 100644 Binary files a/ytmusicapi/locales/de/LC_MESSAGES/base.mo and b/ytmusicapi/locales/de/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/de/LC_MESSAGES/base.po b/ytmusicapi/locales/de/LC_MESSAGES/base.po index d2e962b..e5b2334 100644 --- a/ytmusicapi/locales/de/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/de/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "künstler" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "playlist" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "titel" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "video" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "sender" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "profil" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Folge" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "alben" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "singles" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "videos" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "playlists" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "das könnte fans auch gefallen" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "neueste folgen" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "podcasts" diff --git a/ytmusicapi/locales/en/LC_MESSAGES/base.mo b/ytmusicapi/locales/en/LC_MESSAGES/base.mo index 41f2c1a..bd9640c 100644 Binary files a/ytmusicapi/locales/en/LC_MESSAGES/base.mo and b/ytmusicapi/locales/en/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/en/LC_MESSAGES/base.po b/ytmusicapi/locales/en/LC_MESSAGES/base.po index 141db84..217b35c 100644 --- a/ytmusicapi/locales/en/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/en/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "fans might also like" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "latest episodes" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "" diff --git a/ytmusicapi/locales/es/LC_MESSAGES/base.mo b/ytmusicapi/locales/es/LC_MESSAGES/base.mo index 11cde3b..934525e 100644 Binary files a/ytmusicapi/locales/es/LC_MESSAGES/base.mo and b/ytmusicapi/locales/es/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/es/LC_MESSAGES/base.po b/ytmusicapi/locales/es/LC_MESSAGES/base.po index 706a8b6..3cb39aa 100644 --- a/ytmusicapi/locales/es/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/es/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "artista" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "lista de reproducción" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "canción" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "vídeo" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "emisora" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "perfil" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "Pódcast" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Episodio" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "álbumes" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "sencillos" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "vídeos" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "listas de reproducción" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "puede que también te guste" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "últimos episodios" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "pódcasts" diff --git a/ytmusicapi/locales/fr/LC_MESSAGES/base.mo b/ytmusicapi/locales/fr/LC_MESSAGES/base.mo index 6f3aa4b..1445bcd 100644 Binary files a/ytmusicapi/locales/fr/LC_MESSAGES/base.mo and b/ytmusicapi/locales/fr/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/fr/LC_MESSAGES/base.po b/ytmusicapi/locales/fr/LC_MESSAGES/base.po index 4773fa6..80da1e9 100644 --- a/ytmusicapi/locales/fr/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/fr/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "artiste" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "playlist" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "titre" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "vidéo" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "radio" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "profil" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Épisode" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "vidéos" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "vous aimerez peut-être aussi" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "épisodes les plus récents" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "" diff --git a/ytmusicapi/locales/hi/LC_MESSAGES/base.mo b/ytmusicapi/locales/hi/LC_MESSAGES/base.mo index b46ef7c..4b25d54 100644 Binary files a/ytmusicapi/locales/hi/LC_MESSAGES/base.mo and b/ytmusicapi/locales/hi/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/hi/LC_MESSAGES/base.po b/ytmusicapi/locales/hi/LC_MESSAGES/base.po index c111511..3315116 100644 --- a/ytmusicapi/locales/hi/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/hi/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-01-01 11:04+0530\n" "Last-Translator: \n" "Language-Team: \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "कलाकार" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "प्लेलिस्ट" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "गीत" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "वीडियो" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "स्टेशन" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "प्रोफ़ाइल" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "पॉडकास्ट" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "एपिसोड" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "एलबम" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "एकल" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "वीडियो" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "प्लेलिस्ट" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "सम्बंधित" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "सबसे नए एपिसोड" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "पॉडकास्ट" diff --git a/ytmusicapi/locales/it/LC_MESSAGES/base.mo b/ytmusicapi/locales/it/LC_MESSAGES/base.mo index 80083b1..1ffe818 100644 Binary files a/ytmusicapi/locales/it/LC_MESSAGES/base.mo and b/ytmusicapi/locales/it/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/it/LC_MESSAGES/base.po b/ytmusicapi/locales/it/LC_MESSAGES/base.po index c0d3892..c120ab3 100644 --- a/ytmusicapi/locales/it/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/it/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "artista" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "brano" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "stazione" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "profilo" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Puntata" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "album" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "singoli" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "video" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "playlist" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "ai fan potrebbe anche piacere" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "puntate più recenti" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "podcast" diff --git a/ytmusicapi/locales/ja/LC_MESSAGES/base.mo b/ytmusicapi/locales/ja/LC_MESSAGES/base.mo index cd58711..804ee80 100644 Binary files a/ytmusicapi/locales/ja/LC_MESSAGES/base.mo and b/ytmusicapi/locales/ja/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/ja/LC_MESSAGES/base.po b/ytmusicapi/locales/ja/LC_MESSAGES/base.po index 876b460..5e736be 100644 --- a/ytmusicapi/locales/ja/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/ja/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "アーティスト" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "プレイリスト" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "曲" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "動画" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "ステーション" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "プロフィール" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "ポッドキャスト" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "エピソード" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "アルバム" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "シングル" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "動画" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "プレイリスト" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "おすすめのアーティスト" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "最新エピソード" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "ポッドキャスト" diff --git a/ytmusicapi/locales/ko/LC_MESSAGES/base.mo b/ytmusicapi/locales/ko/LC_MESSAGES/base.mo index c7ad36a..16cd6c0 100644 Binary files a/ytmusicapi/locales/ko/LC_MESSAGES/base.mo and b/ytmusicapi/locales/ko/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/ko/LC_MESSAGES/base.po b/ytmusicapi/locales/ko/LC_MESSAGES/base.po index 0150535..fb7b62a 100644 --- a/ytmusicapi/locales/ko/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/ko/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "아티스트" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "재생목록" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "노래" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "동영상" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "스테이션" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "프로필" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "팟캐스트" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "에피소드" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "앨범" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "싱글" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "동영상" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "재싱목록" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "fans might also like" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "최신 에피소드" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "팟캐스트" diff --git a/ytmusicapi/locales/nl/LC_MESSAGES/base.mo b/ytmusicapi/locales/nl/LC_MESSAGES/base.mo index c384442..e3c5756 100644 Binary files a/ytmusicapi/locales/nl/LC_MESSAGES/base.mo and b/ytmusicapi/locales/nl/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/nl/LC_MESSAGES/base.po b/ytmusicapi/locales/nl/LC_MESSAGES/base.po index c309359..060c566 100644 --- a/ytmusicapi/locales/nl/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/nl/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-04-23 14:55+0200\n" "Last-Translator: Heimen Stoffels \n" "Language-Team: \n" @@ -18,54 +18,62 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "artiest" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "afspeellijst" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "nummer" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "video" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "station" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "profiel" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Aflevering" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "albums" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "singles" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "video's" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "afspeellijsten" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "gerelateerd" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "nieuwste afleveringen" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "podcasts" diff --git a/ytmusicapi/locales/pt/LC_MESSAGES/base.mo b/ytmusicapi/locales/pt/LC_MESSAGES/base.mo index d93b51b..d187877 100644 Binary files a/ytmusicapi/locales/pt/LC_MESSAGES/base.mo and b/ytmusicapi/locales/pt/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/pt/LC_MESSAGES/base.po b/ytmusicapi/locales/pt/LC_MESSAGES/base.po index cfe35c4..f7c59eb 100644 --- a/ytmusicapi/locales/pt/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/pt/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-01-01 12:15+0530\n" "Last-Translator: \n" "Language-Team: \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "artista" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "lista de reprodução" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "música" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "vídeo" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "estação" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "perfil" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Episódio" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "álbuns" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "solteiros" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "vídeos" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "listas de reprodução" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "relacionado" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "episódios novos" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "podcasts" diff --git a/ytmusicapi/locales/ru/LC_MESSAGES/base.mo b/ytmusicapi/locales/ru/LC_MESSAGES/base.mo index bef80e6..45330aa 100644 Binary files a/ytmusicapi/locales/ru/LC_MESSAGES/base.mo and b/ytmusicapi/locales/ru/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/ru/LC_MESSAGES/base.po b/ytmusicapi/locales/ru/LC_MESSAGES/base.po index c9cc493..1f96ba0 100644 --- a/ytmusicapi/locales/ru/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/ru/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-01-01 09:48+0530\n" "Last-Translator: \n" "Language-Team: \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "художник" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "плейлист" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "песня" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "видео" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "станция" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "профиль" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "Подкаст" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Выпуск" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "альбомы" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "синглы" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "ролики" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "плейлисты" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "связанные с" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "новые выпуски" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "подкасты" diff --git a/ytmusicapi/locales/tr/LC_MESSAGES/base.mo b/ytmusicapi/locales/tr/LC_MESSAGES/base.mo index a06de82..9e733b5 100644 Binary files a/ytmusicapi/locales/tr/LC_MESSAGES/base.mo and b/ytmusicapi/locales/tr/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/tr/LC_MESSAGES/base.po b/ytmusicapi/locales/tr/LC_MESSAGES/base.po index e3562d5..9210018 100644 --- a/ytmusicapi/locales/tr/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/tr/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-01-02 13:06+0530\n" "Last-Translator: \n" "Language-Team: \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "sanatçı" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "çalma listesi" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "şarkı" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "video" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "istasyon" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "profil" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "Bölüm" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "albümler" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "bekarlar" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "videolar" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "çalma listeleri" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "ilişkili" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "son bölümler" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "podcast'ler" diff --git a/ytmusicapi/locales/ur/LC_MESSAGES/base.mo b/ytmusicapi/locales/ur/LC_MESSAGES/base.mo index a8347da..04106a8 100644 Binary files a/ytmusicapi/locales/ur/LC_MESSAGES/base.mo and b/ytmusicapi/locales/ur/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/ur/LC_MESSAGES/base.po b/ytmusicapi/locales/ur/LC_MESSAGES/base.po index 432bd5e..856622f 100644 --- a/ytmusicapi/locales/ur/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/ur/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: 2023-01-02 22:18+0530\n" "Last-Translator: \n" "Language-Team: \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.2.2\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "فنکار" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "پلے لسٹ" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "نغمہ" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "ویڈیو" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "اسٹیشن" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "پروفائ" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "پوڈکاسٹ" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "ایپی سوڈ" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "البمز" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "سنگلز" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "ویڈیوز" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "پلے لسٹس" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "متعلقہ" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "تازہ ترین ایپی سوڈز" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "پوڈکاسٹس" diff --git a/ytmusicapi/locales/zh_CN/LC_MESSAGES/base.po b/ytmusicapi/locales/zh_CN/LC_MESSAGES/base.po index 1336889..ee472ca 100644 --- a/ytmusicapi/locales/zh_CN/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/zh_CN/LC_MESSAGES/base.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Bruce Zhang \n" "Language-Team: LANGUAGE \n" @@ -16,54 +16,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "音乐人" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "播放列表" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "歌曲" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "视频" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "电台" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "个人资料" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "播客" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "分集" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "专辑" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "单曲" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "视频" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "精选" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "粉丝可能还会喜欢" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "最新分集" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "播客" diff --git a/ytmusicapi/locales/zh_TW/LC_MESSAGES/base.po b/ytmusicapi/locales/zh_TW/LC_MESSAGES/base.po index cb3ba16..a5486d5 100644 --- a/ytmusicapi/locales/zh_TW/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/zh_TW/LC_MESSAGES/base.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-11 16:22+0100\n" +"POT-Creation-Date: 2024-03-05 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,54 +17,62 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: parsers/i18n.py:16 +#: parsers/i18n.py:22 msgid "artist" msgstr "藝人" -#: parsers/i18n.py:16 +#: parsers/i18n.py:23 msgid "playlist" msgstr "播放清單" -#: parsers/i18n.py:16 +#: parsers/i18n.py:24 msgid "song" msgstr "歌曲" -#: parsers/i18n.py:16 +#: parsers/i18n.py:25 msgid "video" msgstr "影片" -#: parsers/i18n.py:16 +#: parsers/i18n.py:26 msgid "station" msgstr "電台" -#: parsers/i18n.py:16 +#: parsers/i18n.py:27 msgid "profile" msgstr "個人資料" -#: parsers/i18n.py:16 +#: parsers/i18n.py:28 msgid "podcast" msgstr "" -#: parsers/i18n.py:16 +#: parsers/i18n.py:29 msgid "episode" msgstr "單集" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "albums" msgstr "專輯" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "singles" msgstr "單曲" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "videos" msgstr "影片" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "playlists" msgstr "精選收錄" -#: parsers/i18n.py:21 +#: parsers/i18n.py:35 msgid "related" msgstr "粉絲可能也會喜歡" + +#: parsers/i18n.py:35 +msgid "episodes" +msgstr "最新集數" + +#: parsers/i18n.py:35 +msgid "podcasts" +msgstr "Podcast" diff --git a/ytmusicapi/mixins/browsing.py b/ytmusicapi/mixins/browsing.py index 390802a..d9df4b3 100644 --- a/ytmusicapi/mixins/browsing.py +++ b/ytmusicapi/mixins/browsing.py @@ -253,7 +253,7 @@ class BrowsingMixin(MixinProtocol): artist["songs"]["browseId"] = nav(musicShelf, TITLE + NAVIGATION_BROWSE_ID) artist["songs"]["results"] = parse_playlist_items(musicShelf["contents"]) - artist.update(self.parser.parse_artist_contents(results)) + artist.update(self.parser.parse_channel_contents(results)) return artist def get_artist_albums( @@ -388,9 +388,9 @@ class BrowsingMixin(MixinProtocol): endpoint = "browse" body = {"browseId": channelId} response = self._send_request(endpoint, body) - user = {"name": nav(response, ["header", "musicVisualHeaderRenderer", *TITLE_TEXT])} + user = {"name": nav(response, [*HEADER_MUSIC_VISUAL, *TITLE_TEXT])} results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST) - user.update(self.parser.parse_artist_contents(results)) + user.update(self.parser.parse_channel_contents(results)) return user def get_user_playlists(self, channelId: str, params: str) -> List[Dict]: diff --git a/ytmusicapi/mixins/library.py b/ytmusicapi/mixins/library.py index 340ef9f..f75ce8f 100644 --- a/ytmusicapi/mixins/library.py +++ b/ytmusicapi/mixins/library.py @@ -197,6 +197,88 @@ class LibraryMixin(MixinProtocol): response, lambda additionalParams: self._send_request(endpoint, body, additionalParams), limit ) + def get_library_podcasts(self, limit: int = 25, order: Optional[str] = None) -> List[Dict]: + """ + Get podcasts the user has added to the library + + :param limit: Number of podcasts to return + :param order: Order of podcasts to return. Allowed values: 'a_to_z', 'z_to_a', 'recently_added'. Default: Default order. + :return: List of podcasts. New Episodes playlist is the first podcast returned, but only if subscribed to relevant podcasts. + + Example:: + + [ + { + "title": "New Episodes", + "channel": + { + "id": null, + "name": "Auto playlist" + }, + "browseId": "VLRDPN", + "podcastId": "RDPN", + "thumbnails": [...] + }, + { + "title": "5 Minuten Harry Podcast", + "channel": + { + "id": "UCDIDXF4WM1qQzerrxeEfSdA", + "name": "coldmirror" + }, + "browseId": "MPSPPLDvBqWb1UAGeEt9n6vFH_zdGw65Obf3sH", + "podcastId": "PLDvBqWb1UAGeEt9n6vFH_zdGw65Obf3sH", + "thumbnails": [...] + } + ] + """ + self._check_auth() + body = {"browseId": "FEmusic_library_non_music_audio_list"} + validate_order_parameter(order) + if order is not None: + body["params"] = prepare_order_params(order) + endpoint = "browse" + response = self._send_request(endpoint, body) + return parse_library_podcasts( + response, lambda additionalParams: self._send_request(endpoint, body, additionalParams), limit + ) + + def get_library_channels(self, limit: int = 25, order: Optional[str] = None) -> List[Dict]: + """ + Get channels the user has added to the library + + :param limit: Number of channels to return + :param order: Order of channels to return. Allowed values: 'a_to_z', 'z_to_a', 'recently_added'. Default: Default order. + :return: List of channels. + + Example:: + + [ + { + "browseId": "UCRFF8xw5dg9mL4r5ryFOtKw", + "artist": "Jumpers Jump", + "subscribers": "1.54M", + "thumbnails": [...] + }, + { + "browseId": "UCQ3f2_sO3NJyDkuCxCNSOVA", + "artist": "BROWN BAG", + "subscribers": "74.2K", + "thumbnails": [...] + } + ] + """ + self._check_auth() + body = {"browseId": "FEmusic_library_non_music_audio_channels_list"} + validate_order_parameter(order) + if order is not None: + body["params"] = prepare_order_params(order) + endpoint = "browse" + response = self._send_request(endpoint, body) + return parse_library_artists( + response, lambda additionalParams: self._send_request(endpoint, body, additionalParams), limit + ) + def get_history(self) -> List[Dict]: """ Gets your play history in reverse chronological order diff --git a/ytmusicapi/mixins/podcasts.py b/ytmusicapi/mixins/podcasts.py index 19f0103..012a9fd 100644 --- a/ytmusicapi/mixins/podcasts.py +++ b/ytmusicapi/mixins/podcasts.py @@ -3,12 +3,97 @@ from typing import Dict from ytmusicapi.continuations import * from ytmusicapi.mixins._protocol import MixinProtocol from ytmusicapi.navigation import * +from ytmusicapi.parsers.browsing import parse_content_list from ytmusicapi.parsers.podcasts import * from ._utils import * class PodcastsMixin(MixinProtocol): + """Podcasts Mixin""" + + def get_channel(self, channelId: str) -> Dict: + """ + Get information about a podcast channel (episodes, podcasts). For episodes, a + maximum of 10 episodes are returned, the full list of episodes can be retrieved + via :py:func:`get_channel_episodes` + + :param channelId: channel id + :return: Dict containing channel info + + Example:: + + { + "title": 'Stanford Graduate School of Business', + "thumbnails": [...] + "episodes": + { + "browseId": "UCGwuxdEeCf0TIA2RbPOj-8g", + "results": + [ + { + "index": 0, + "title": "The Brain Gain: The Impact of Immigration on American Innovation with Rebecca Diamond", + "description": "Immigrants' contributions to America ...", + "duration": "24 min", + "videoId": "TS3Ovvk3VAA", + "browseId": "MPEDTS3Ovvk3VAA", + "videoType": "MUSIC_VIDEO_TYPE_PODCAST_EPISODE", + "date": "Mar 6, 2024", + "thumbnails": [...] + }, + ], + "params": "6gPiAUdxWUJXcFlCQ3BN..." + }, + "podcasts": + { + "browseId": null, + "results": + [ + { + "title": "Stanford GSB Podcasts", + "channel": + { + "id": "UCGwuxdEeCf0TIA2RbPOj-8g", + "name": "Stanford Graduate School of Business" + }, + "browseId": "MPSPPLxq_lXOUlvQDUNyoBYLkN8aVt5yAwEtG9", + "podcastId": "PLxq_lXOUlvQDUNyoBYLkN8aVt5yAwEtG9", + "thumbnails": [...] + } + ] + } + } + """ + body = {"browseId": channelId} + endpoint = "browse" + response = self._send_request(endpoint, body) + + channel = { + "title": nav(response, [*HEADER_MUSIC_VISUAL, *TITLE_TEXT]), + "thumbnails": nav(response, [*HEADER_MUSIC_VISUAL, *THUMBNAILS]), + } + + results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST) + channel.update(self.parser.parse_channel_contents(results)) + + return channel + + def get_channel_episodes(self, channelId: str, params: str) -> List[Dict]: + """ + Get all channel episodes. This endpoint is currently unlimited + + :param channelId: channelId of the user + :param params: params obtained by :py:func:`get_channel` + + :return: List of channel episodes in the format of :py:func:`get_channel` "episodes" key + """ + body = {"browseId": channelId, "params": params} + endpoint = "browse" + response = self._send_request(endpoint, body) + results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + GRID_ITEMS) + return parse_content_list(results, parse_episode, MMRIR) + def get_podcast(self, playlistId: str, limit: Optional[int] = 100) -> Dict: """ Returns podcast metadata and episodes @@ -19,6 +104,34 @@ class PodcastsMixin(MixinProtocol): :param playlistId: Playlist id :param limit: How many songs to return. `None` retrieves them all. Default: 100 + :return: Dict with podcast information + + Example:: + + { + "author": + { + "name": "Stanford Graduate School of Business", + "id": "UCGwuxdEeCf0TIA2RbPOj-8g" + }, + "title": "Think Fast, Talk Smart: The Podcast", + "description": "Join Matt Abrahams, a lecturer of...", + "saved": false, + "episodes": + [ + { + "index": 0, + "title": "132. Lean Into Failure: How to Make Mistakes That Work | Think Fast, Talk Smart: Communication...", + "description": "Effective and productive teams and...", + "duration": "25 min", + "videoId": "xAEGaW2my7E", + "browseId": "MPEDxAEGaW2my7E", + "videoType": "MUSIC_VIDEO_TYPE_PODCAST_EPISODE", + "date": "Mar 5, 2024", + "thumbnails": [...] + } + ] + } """ browseId = "MPSP" + playlistId if not playlistId.startswith("MPSP") else playlistId body = {"browseId": browseId} @@ -29,11 +142,11 @@ class PodcastsMixin(MixinProtocol): podcast = parse_podcast_header(header) results = nav(two_columns, ["secondaryContents", *SECTION_LIST_ITEM, *MUSIC_SHELF]) - episodes = parse_episodes(results["contents"]) + parse_func = lambda contents: parse_content_list(contents, parse_episode, MMRIR) + episodes = parse_func(results["contents"]) if "continuations" in results: request_func = lambda additionalParams: self._send_request(endpoint, body, additionalParams) - parse_func = lambda contents: parse_episodes(contents) remaining_limit = None if limit is None else (limit - len(episodes)) episodes.extend( get_continuations( @@ -51,10 +164,54 @@ class PodcastsMixin(MixinProtocol): .. note:: - To save an episode, you need to call `add_playlist_items` to add - it to the `SE` (saved episodes) playlist. + To save an episode, you need to call `add_playlist_items` to add + it to the `SE` (saved episodes) playlist. :param videoId: browseId (MPED..) or videoId for a single episode + :return: Dict containing information about the episode + + The description elements are based on a custom dataclass, not shown in the example below + The description text items also contain "\n" to indicate newlines, removed below due to RST issues + + Example:: + + { + "author": + { + "name": "Stanford GSB Podcasts", + "id": "MPSPPLxq_lXOUlvQDUNyoBYLkN8aVt5yAwEtG9" + }, + "title": "124. Making Meetings Me...", + "date": "Jan 16, 2024", + "duration": "25 min", + "saved": false, + "playlistId": "MPSPPLxq_lXOUlvQDUNyoBYLkN8aVt5yAwEtG9", + "description": + [ + { + "text": "Delve into why people hate meetings, ... Karin Reed (" + }, + { + "text": "https://speakerdynamics.com/team/", + "url": "https://speakerdynamics.com/team/" + }, + { + "text": ")Chapters:(" + }, + { + "text": "00:00", + "seconds": 0 + }, + { + "text": ") Introduction Host Matt Abrahams...(" + }, + { + "text": "01:30", + "seconds": 90 + }, + ] + } + """ browseId = "MPED" + videoId if not videoId.startswith("MPED") else videoId body = {"browseId": browseId} diff --git a/ytmusicapi/navigation.py b/ytmusicapi/navigation.py index 78d4e16..e82d7bf 100644 --- a/ytmusicapi/navigation.py +++ b/ytmusicapi/navigation.py @@ -48,6 +48,7 @@ TEXT_RUN = [*TEXT_RUNS, 0] TEXT_RUN_TEXT = [*TEXT_RUN, "text"] SUBTITLE = ["subtitle", *RUN_TEXT] SUBTITLE_RUNS = ["subtitle", "runs"] +SUBTITLE_RUN = [*SUBTITLE_RUNS, 0] SUBTITLE2 = [*SUBTITLE_RUNS, 2, "text"] SUBTITLE3 = [*SUBTITLE_RUNS, 4, "text"] THUMBNAIL = ["thumbnail", "thumbnails"] @@ -61,6 +62,7 @@ BADGE_LABEL = ["badges", *BADGE_PATH] SUBTITLE_BADGE_LABEL = ["subtitleBadges", *BADGE_PATH] CATEGORY_TITLE = ["musicNavigationButtonRenderer", "buttonText", *RUN_TEXT] CATEGORY_PARAMS = ["musicNavigationButtonRenderer", "clickCommand", "browseEndpoint", "params"] +MMRIR = "musicMultiRowListItemRenderer" MRLIR = "musicResponsiveListItemRenderer" MTRIR = "musicTwoRowItemRenderer" MNIR = "menuNavigationItemRenderer" @@ -71,6 +73,7 @@ MENU_PLAYLIST_ID = [*MENU_ITEMS, 0, MNIR, *NAVIGATION_WATCH_PLAYLIST_ID] MULTI_SELECT = ["musicMultiSelectMenuItemRenderer"] HEADER_DETAIL = ["header", "musicDetailHeaderRenderer"] HEADER_SIDE = ["header", "musicSideAlignedItemRenderer"] +HEADER_MUSIC_VISUAL = ["header", "musicVisualHeaderRenderer"] DESCRIPTION_SHELF = ["musicDescriptionShelfRenderer"] DESCRIPTION = ["description", *RUN_TEXT] CAROUSEL = ["musicCarouselShelfRenderer"] diff --git a/ytmusicapi/parsers/i18n.py b/ytmusicapi/parsers/i18n.py index f808304..24f319a 100644 --- a/ytmusicapi/parsers/i18n.py +++ b/ytmusicapi/parsers/i18n.py @@ -1,6 +1,15 @@ +from gettext import gettext as _ from typing import Any, Dict, List -from ytmusicapi.navigation import CAROUSEL, CAROUSEL_TITLE, NAVIGATION_BROWSE_ID, nav +from ytmusicapi.navigation import ( + CAROUSEL, + CAROUSEL_TITLE, + MMRIR, + MTRIR, + NAVIGATION_BROWSE, + NAVIGATION_BROWSE_ID, + nav, +) from ytmusicapi.parsers._utils import i18n from ytmusicapi.parsers.browsing import ( parse_album, @@ -10,6 +19,7 @@ from ytmusicapi.parsers.browsing import ( parse_single, parse_video, ) +from ytmusicapi.parsers.podcasts import parse_episode, parse_podcast class Parser: @@ -30,27 +40,35 @@ class Parser: ] @i18n - def parse_artist_contents(self, results: List) -> Dict: - categories = ["albums", "singles", "videos", "playlists", "related"] - categories_local = [_("albums"), _("singles"), _("videos"), _("playlists"), _("related")] # type: ignore[name-defined] - categories_parser = [parse_album, parse_single, parse_video, parse_playlist, parse_related_artist] + def parse_channel_contents(self, results: List) -> Dict: + # type: ignore[name-defined] + categories = [ + ("albums", _("albums"), parse_album, MTRIR), + ("singles", _("singles"), parse_single, MTRIR), + ("videos", _("videos"), parse_video, MTRIR), + ("playlists", _("playlists"), parse_playlist, MTRIR), + ("related", _("related"), parse_related_artist, MTRIR), + ("episodes", _("episodes"), parse_episode, MMRIR), + ("podcasts", _("podcasts"), parse_podcast, MTRIR), + ] artist: Dict[str, Any] = {} - for i, category in enumerate(categories): + for category, category_local, category_parser, category_key in categories: data = [ r["musicCarouselShelfRenderer"] for r in results if "musicCarouselShelfRenderer" in r - and nav(r, CAROUSEL + CAROUSEL_TITLE)["text"].lower() == categories_local[i] + and nav(r, CAROUSEL + CAROUSEL_TITLE)["text"].lower() == category_local ] if len(data) > 0: artist[category] = {"browseId": None, "results": []} if "navigationEndpoint" in nav(data[0], CAROUSEL_TITLE): artist[category]["browseId"] = nav(data[0], CAROUSEL_TITLE + NAVIGATION_BROWSE_ID) - if category in ["albums", "singles", "playlists"]: - artist[category]["params"] = nav(data[0], CAROUSEL_TITLE)["navigationEndpoint"][ - "browseEndpoint" - ]["params"] + artist[category]["params"] = nav( + data[0], CAROUSEL_TITLE + NAVIGATION_BROWSE + ["params"], True + ) - artist[category]["results"] = parse_content_list(data[0]["contents"], categories_parser[i]) + artist[category]["results"] = parse_content_list( + data[0]["contents"], category_parser, key=category_key + ) return artist diff --git a/ytmusicapi/parsers/library.py b/ytmusicapi/parsers/library.py index 7cc6464..293f3c0 100644 --- a/ytmusicapi/parsers/library.py +++ b/ytmusicapi/parsers/library.py @@ -1,7 +1,9 @@ from ytmusicapi.continuations import get_continuations from ._utils import * +from .browsing import parse_content_list from .playlists import parse_playlist_items +from .podcasts import parse_podcast from .songs import parse_song_runs @@ -60,6 +62,20 @@ def parse_albums(results): return albums +def parse_library_podcasts(response, request_func, limit): + results = get_library_contents(response, GRID) + parse_func = lambda contents: parse_content_list(contents, parse_podcast) + podcasts = parse_func(results["items"][1:]) # skip first entry "Add podcast" + + if "continuations" in results: + remaining_limit = None if limit is None else (limit - len(podcasts)) + podcasts.extend( + get_continuations(results, "gridContinuation", remaining_limit, request_func, parse_func) + ) + + return podcasts + + def parse_library_artists(response, request_func, limit): results = get_library_contents(response, MUSIC_SHELF) if results is None: diff --git a/ytmusicapi/parsers/podcasts.py b/ytmusicapi/parsers/podcasts.py index 3637560..20836ff 100644 --- a/ytmusicapi/parsers/podcasts.py +++ b/ytmusicapi/parsers/podcasts.py @@ -1,5 +1,4 @@ from dataclasses import dataclass -from typing import Sequence from .songs import * @@ -23,18 +22,13 @@ class Timestamp(DescriptionElement): @dataclass -class Description(Sequence): - def __len__(self): - return len(self.elements) - - def __getitem__(self, index): - return self.elements[index] - - elements: Sequence[DescriptionElement] +class Description(List[DescriptionElement]): + def __init__(self, *args, **kwargs): + super().__init__(args[0]) @property def text(self) -> str: - return "".join(str(element) for element in self.elements) + return "".join(str(element) for element in self) @classmethod def from_runs(cls, description_runs: List[Dict]) -> "Description": @@ -44,7 +38,7 @@ class Description(Sequence): :return: List of text (str), timestamp (int) and link values (Link object) """ - elements = [] + elements: List[DescriptionElement] = [] for run in description_runs: navigationEndpoint = nav(run, ["navigationEndpoint"], True) if navigationEndpoint: @@ -61,7 +55,7 @@ class Description(Sequence): elements.append(element) - return cls(elements=elements) + return cls(elements) def _parse_base_header(header: Dict) -> Dict: @@ -92,7 +86,7 @@ def parse_episode_header(header: Dict) -> Dict: progress_renderer = nav(header, ["progress", "musicPlaybackProgressRenderer"]) metadata["duration"] = nav(progress_renderer, ["durationText", "runs", 1, "text"], True) metadata["progressPercentage"] = nav(progress_renderer, ["playbackProgressPercentage"]) - metadata["saved"] = nav(header, ["buttons", 0, *TOGGLED_BUTTON], True) + metadata["saved"] = nav(header, ["buttons", 0, *TOGGLED_BUTTON], True) or False metadata["playlistId"] = None menu_buttons = nav(header, ["buttons", -1, "menuRenderer", "items"]) @@ -103,34 +97,40 @@ def parse_episode_header(header: Dict) -> Dict: return metadata -def parse_episodes(results) -> List[Dict]: - episodes = [] - for result in results: - data = nav(result, ["musicMultiRowListItemRenderer"]) - thumbnails = nav(data, THUMBNAILS) - if len(nav(data, SUBTITLE_RUNS)) == 1: - duration = nav(data, SUBTITLE) - else: - date = nav(data, SUBTITLE) - duration = nav(data, SUBTITLE2, True) - title = nav(data, TITLE_TEXT) - description = nav(data, DESCRIPTION, True) - videoId = nav(data, ["onTap", *WATCH_VIDEO_ID], True) - browseId = nav(data, [*TITLE, *NAVIGATION_BROWSE_ID], True) - videoType = nav(data, ["onTap", *NAVIGATION_VIDEO_TYPE], True) - index = nav(data, ["onTap", "watchEndpoint", "index"]) - episodes.append( - { - "index": index, - "title": title, - "description": description, - "duration": duration, - "videoId": videoId, - "browseId": browseId, - "videoType": videoType, - "date": date, - "thumbnails": thumbnails, - } - ) +def parse_episode(data): + """Parses a single episode under "Episodes" on a channel page or on a podcast page""" + thumbnails = nav(data, THUMBNAILS) + date = None + if len(nav(data, SUBTITLE_RUNS)) == 1: + duration = nav(data, SUBTITLE) + else: + date = nav(data, SUBTITLE) + duration = nav(data, SUBTITLE2, True) + title = nav(data, TITLE_TEXT) + description = nav(data, DESCRIPTION, True) + videoId = nav(data, ["onTap", *WATCH_VIDEO_ID], True) + browseId = nav(data, [*TITLE, *NAVIGATION_BROWSE_ID], True) + videoType = nav(data, ["onTap", *NAVIGATION_VIDEO_TYPE], True) + index = nav(data, ["onTap", "watchEndpoint", "index"]) + return { + "index": index, + "title": title, + "description": description, + "duration": duration, + "videoId": videoId, + "browseId": browseId, + "videoType": videoType, + "date": date, + "thumbnails": thumbnails, + } - return episodes + +def parse_podcast(data): + """Parses a single podcast under "Podcasts" on a channel page""" + return { + "title": nav(data, TITLE_TEXT), + "channel": parse_id_name(nav(data, [*SUBTITLE_RUNS, 0])), + "browseId": nav(data, TITLE + NAVIGATION_BROWSE_ID), + "podcastId": nav(data, THUMBNAIL_OVERLAY, True), + "thumbnails": nav(data, THUMBNAIL_RENDERER), + }