API reference

This section will detail how vidyo can be used.

Version info

vidyo.__version__

The currently installed vidyo version, represented in the PEP 440 format.

Exceptions

class vidyo.errors.VidyoError

The base exception class.

class vidyo.errors.ResponseNotOK

Exception thrown when a request returned a non-OK status code.

Classes

class vidyo.client.Client(key: str)

The client class.

Parameters

key (str) – The API key for the YouTube Data API.

get_video(id_: str)vidyo.video.Video

Executes an API request to get video information.

Parameters

id (str) – The video ID to get information for.

Returns

An object containing video information.

Return type

Video

Raises

ResponseNotOK – The request returned a non-OK status code.

class vidyo.video.Video(data: dict)

An object containing video information.

Parameters

data (dict) – Response data from the YouTube Data API. This should be the first element in the items list.

id

The video ID.

Type

str

published

The date and time and the video was published.

Type

datetime.datetime

channel

The YouTube channel to which the video was published.

Type

PartialChannel

title

The video title.

Type

str

description

The video’s description.

Type

str

tags

A list of the video’s tags. If there are none, this is an empty list.

Type

list[str]

category_id

The video’s category’s ID.

Type

int

live

Whether the video is currently live. This could mean it is a premiere or a live stream.

Type

bool

duration

The video’s duration.

Type

datetime.timedelta

is_3d

Whether the video was uploaded in 3D.

Type

bool

is_hd

Whether there is a HD version of the video available (720p or above).

Type

bool

captioned

Whether there are captions available on the video.

Type

bool

is_360

Whether the video was recorded in 360 degrees.

Type

bool

privacy

The video’s privacy status. Can be “public”, “unlisted”, or “private”.

Type

str

license

The video’s license. Can be either “youtube” or “creativeCommon”.

Type

str

embeddable

Whether the video is embeddable.

Type

bool

for_kids

Whether the video is marked as “Made For Kids”.

Type

bool

views

The number of views the video has. If this is not available, this will be -1.

Type

int

likes

The number of likes the video has. If ratings are disabled, this will be -1.

Type

int

dislikes

The number of dislikes the video has. If ratings are disabled, this will be -1.

Type

int

favourites

The number of favourites the video has. If this is not available, this will be -1.

Type

int

comments

The number of comments the video has. If comments are disabled, this will be -1.

Type

int

get_thumbnail()PIL.Image.Image

Gets the highest resolution thumbnail available.

Returns

A Pillow image.

Return type

PIL.Image.Image

Raises

ResponseNotOK – The request returned a non-OK status code.

class vidyo.channel.PartialChannel(id_: str, name: str)

An object with limited channel information.

Parameters
  • id (str) – The channel ID.

  • name (str) – The channel name.

id

The channel ID.

Type

str

name

The channel name.

Type

str