Skip to content

Introduce Structure

This doc will show you the new api structure for this library.

Brief

To make the package easier to maintain and easy to use. We have shifted to using classes for different YouTube resources in an easier, higher-level, programming experience.

structure-uml

In this structure, every resource has a self class.

Simple usage

Initial Client

from pyyoutube import Client

client = Client(api_key="your api key")

Get data.

for example to get channel data.

resp = client.channels.list(
    parts=["id", "snippet"],
    channel_id="UCa-vrCLQHviTOVnEKDOdetQ"    
)
# resp output
# ChannelListResponse(kind='youtube#channelListResponse')
# resp.items[0].id  output
# UCa-vrCLQHviTOVnEKDOdetQ