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+.
- Asynchronous API client to retrieve YouTube Data API resources.
- Built with
dataclassesonly. Minimal dependencies:aiohttpandorjson.
Install the package directly from the repository:
rye add python-youtube --git https://github.com/Maekersuite/python-youtube --branch master
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'))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')The following resources are available: