5.2.1. ytpb

Ytpb is a playback for YouTube live streams.

This is the main entry point of the package.

ytpb.get_playback(stream_url_or_id: str, use_cache: bool = True, force_update_cache: bool = False, fetcher: InfoFetcher | None = None) Playback

Gets a playback for a live stream.

By default, it uses cache to store essential information between runs. The default cache directory is $XDG_CACHE_HOME/ytpb (with a fallback to ~/.cache/ytpb).

Parameters:
  • stream_url_or_id – A live stream URL or ID.

  • use_cache – Whether to use cache.

  • force_update_cache – Whether to force update cache item.

  • fetcher – An information fetcher to use. By default, YtpbInfoFetcher is used.

Returns:

A Playback object.

Raises:

BroadcastStatusError – If broadcast status of a live stream is not ACTIVE.