yb.youtube.playlists¶
YouTube playlist operations: find/create a playlist and add videos to it.
Wraps the Data API playlists and playlistItems resources (writable with
the youtube.force-ssl scope yb already requests — no extra consent). The
high-level add_video_to_playlist() works from a stable human title like
"TW Uploads": it finds the playlist (optionally creating it), skips the add
if the video is already in it, and appends otherwise — so re-publishing or
re-running is idempotent.
Functions
|
Add |
|
Find-or-create the playlist named |
|
Create a playlist and return its id. |
|
Return the id of the playlist titled |
|
Return the id of the caller's playlist titled |
|
The 0-based position of |
|
Whether |
|
Return all playlists owned by the authenticated channel (paginated). |
|
The |
|
Ids of the authenticated channel's playlists that hold |
|
Remove every occurrence of |
- yb.youtube.playlists.add_to_playlist(video_id, playlist_id, *, position=None, service=None, **cred_kwargs)[source]¶
Add
video_idtoplaylist_id(playlistItems.insert).Appended at the end, or inserted at the 0-based
positionwhen given (YouTube refuses a position on a playlist not sorted manually).- Return type:
- yb.youtube.playlists.add_video_to_playlist(video_id, title, *, create=True, privacy_status='private', skip_if_present=True, service=None, **cred_kwargs)[source]¶
Find-or-create the playlist named
titleand appendvideo_id.Idempotent: with
skip_if_present(default), a video already in the playlist is left alone instead of duplicated.
- yb.youtube.playlists.create_playlist(title, *, description='', privacy_status='private', service=None, **cred_kwargs)[source]¶
Create a playlist and return its id.
- Return type:
- yb.youtube.playlists.ensure_playlist(title, *, create=True, description='', privacy_status='private', service=None, **cred_kwargs)[source]¶
Return the id of the playlist titled
title, creating it if missing.Returns
Noneonly when the playlist is absent andcreate=False.
- yb.youtube.playlists.find_playlist(title, *, service=None, **cred_kwargs)[source]¶
Return the id of the caller’s playlist titled
title(orNone).Matches the first playlist with an exact title; YouTube allows duplicate titles, so prefer unique playlist names.
- yb.youtube.playlists.first_position(video_id, playlist_id, *, service=None, **cred_kwargs)[source]¶
The 0-based position of
video_id’s first occurrence (Noneif absent).
- yb.youtube.playlists.is_video_in_playlist(video_id, playlist_id, *, service=None, **cred_kwargs)[source]¶
Whether
video_idis already an item ofplaylist_id(paginated).- Return type:
- yb.youtube.playlists.list_my_playlists(*, service=None, **cred_kwargs)[source]¶
Return all playlists owned by the authenticated channel (paginated).
- yb.youtube.playlists.playlist_item_ids(video_id, playlist_id, *, service=None, **cred_kwargs)[source]¶
The
playlistItemsids holdingvideo_idinplaylist_id.A list, because a video can sit in one playlist more than once.