Client¶
Client library.
- exception youtube_unofficial.client.NoFeedbackToken¶
No feedback token found.
- class youtube_unofficial.client.YouTubeClient(session: niquests.AsyncSession)¶
YouTube client for managing playlists and history.
- async clear_playlist(playlist_id: str) None¶
Remove all videos from the specified playlist.
Use
WLfor Watch Later.
- async clear_watch_history() bool¶
Clear watch history.
- Returns:¶
Trueif the operation was successful,Falseotherwise.- Return type:¶
- Raises:¶
NoFeedbackToken – If the feedback token cannot be found in the page data.
- async get_history_info() AsyncGenerator[dict[str, Any], None]¶
Get information about the History playlist.
- Yields:¶
dict[str, Any] – The history information.
- Raises:¶
RuntimeError – If a continuation token cannot be found.
- async get_history_video_ids() AsyncGenerator[str, None]¶
-
async get_history_video_ids(*, return_dict: True =
True) AsyncGenerator[HistoryVideoIDsEntry, None] -
async get_history_video_ids(*, return_dict: False =
False) AsyncGenerator[str, None] Get video IDs from the History playlist.
- async get_playlist_info(playlist_id: str) AsyncGenerator[PlaylistInfo, None]¶
Get playlist information.
- async get_playlist_video_ids(playlist_id: str) AsyncGenerator[str, None]¶
- async get_playlist_video_ids(playlist_id: str, *, return_dict: True) AsyncGenerator[PlaylistVideoIDsEntry, None]
- async get_playlist_video_ids(playlist_id: str, *, return_dict: False) AsyncGenerator[str, None]
Get video IDs from a playlist.
-
async remove_set_video_id_from_playlist(playlist_id: str, set_video_id: str, *, cache_values: bool | None =
False) bool¶ Remove a video from a playlist by its setVideoId.
-
async remove_video_id_from_playlist(playlist_id: str, video_id: str, *, cache_values: bool | None =
False) bool¶ Remove a video from a playlist.
- async remove_video_ids_from_history(video_ids: collections.abc.Sequence[str]) bool¶
Delete a history entry by video ID.
- session¶
Niquests
AsyncSessioninstance.