Skip to content

dvago/python-youtube

 
 

Repository files navigation

Python YouTube

An async implementation of Python API for YouTube Data V3 based on: python-youtube. Thanks a lot for the original developers 🙏

NOTE: It's a breaking fork. A lot of functionality has been removed or completely refactored. This fork doesn't support Media uploads, the old API client, update, delete, insert API operations. It only works with dataclasses. It is intended to be a performant and robust client to retrieve resources from the API only.

Compatible with Python 3.12+.

Features

  • Asynchronous API client to retrieve YouTube Data API resources.
  • Built with dataclasses only. Minimal dependencies: aiohttp and orjson.

Installation

Install the package directly from the repository:

rye add python-youtube --git https://github.com/Maekersuite/python-youtube --branch master

Usage

Client Initialization

You can initialize the client using either an API key or an access token:

from pyyoutube import Client, APIKeyAuthentication

# Using API key
client = Client(APIKeyAuthentication(api_key='YOUR_API_KEY'))

# Using access token
client = Client(AccessTokenAuthentication(access_token='YOUR_ACCESS_TOKEN'))

Retrieving Videos

To retrieve videos, you can use the videos.list method:

videos = await client.videos.list(video_id'VIDEO_ID')

Some of the resources subgroups are encapsulated in their parent resource classes. For example, to retrieve VideoCategories, you need to use client.video.categories.list().

categories = await client.video.categories.list(region_code='US')

Available Resources

The following resources are available:

About

An async Python wrapper to retrieve data from YouTube Data API

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Python 100.0%