diff --git a/tests/mixins/test_podcasts.py b/tests/mixins/test_podcasts.py index 1a62b8a..b9d6d89 100644 --- a/tests/mixins/test_podcasts.py +++ b/tests/mixins/test_podcasts.py @@ -18,7 +18,7 @@ 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"]) == 50 + assert len(result["description"]) >= 20 assert not result["saved"] assert result["playlistId"] is not None diff --git a/ytmusicapi/parsers/podcasts.py b/ytmusicapi/parsers/podcasts.py index 1883642..3637560 100644 --- a/ytmusicapi/parsers/podcasts.py +++ b/ytmusicapi/parsers/podcasts.py @@ -88,6 +88,10 @@ def parse_episode_header(header: Dict) -> Dict: metadata = _parse_base_header(header) metadata["date"] = nav(header, [*SUBTITLE2]) metadata["duration"] = nav(header, [*SUBTITLE3], True) + if not metadata["duration"]: # progress started + 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["playlistId"] = None