Skip to content

Commit 44ae73c

Browse files
authored
Add playlist id getter for channel (#53)
1 parent a875a67 commit 44ae73c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/youtubeaio/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ class YouTubeChannel(BaseModel):
108108
alias="contentDetails",
109109
)
110110

111+
@property
112+
def upload_playlist_id(self) -> str:
113+
"""Return playlist id with uploads from channel."""
114+
return str(self.channel_id).replace("UC", "UU", 1)
115+
111116

112117
class YouTubeSubscriptionSnippet(BaseModel):
113118
"""Model representing a YouTube subscription snippet."""

tests/test_channel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ async def test_fetch_channel(
3232
)
3333
channel = await channel_generator.__anext__()
3434
assert channel
35+
assert channel.channel_id == "UC_x5XG1OV2P6uZZ5FSM9Ttw"
36+
assert channel.upload_playlist_id == "UU_x5XG1OV2P6uZZ5FSM9Ttw"
3537
assert channel.snippet
3638
assert channel.snippet.published_at == datetime(
3739
2007,

0 commit comments

Comments
 (0)