podcasts features ✨ (#559)

This commit is contained in:
sigma67 2024-03-06 23:02:19 +01:00 • committed by GitHub
commit 90d172b1d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 802 additions and 318 deletions

View file

@ -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

View file

@ -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")