5.2.7. ytpb.info

Basic information about videos.

class ytpb.info.BroadcastStatus(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Represents a live broadcast status.

ACTIVE = 'active'

A broadcast is live.

UPCOMING = 'upcoming'

A broadcast has been scheduled but started.

COMPLETED = 'completed'

A broadcast has been completed.

NONE = 'none'

A video is not a live broadcast.

class ytpb.info.YouTubeVideoInfo(url: str, title: str, author: str, status: BroadcastStatus, dash_manifest_url: str | None = None)

Bases: object

Represents information about a video.

url: str

Youtube video URL.

title: str

Video’s title.

author: str

Video’s author (channel’s name).

status: BroadcastStatus

Video’ broadcast status.

dash_manifest_url: str | None = None
class ytpb.info.LeftNotFetched

Bases: object

ytpb.info.LEFT_NOT_FETCHED = <ytpb.info.LeftNotFetched object>

A sentinel object for a value that is intentionally not fetched.

ytpb.info.extract_video_info(url: str, index_page_text: str) YouTubeVideoInfo

Extracts an information about a video from an index page.

Parameters:
  • url – A video URL.

  • index_page_text – An index page string content.

Returns:

A YouTubeVideoInfo filled with extracted attributes.

Raises:

InfoExtractError – If failed to extract an attribute.