Skip to main content

No-boilerplate, async and typed YouTube Data API access.

Project description

sly logo Sly YouTube Data API for Python

🚧 This library is an early work in progress! Breaking changes may be frequent.

🐍 For Python 3.10+

No-boilerplate, async, typed access to YouTube Data API 😋

pip install slyytdapi

This library does not have full coverage. All methods are read-only. Currently, the following topics are supported:

  • Videos & Playlists
  • Channels
  • Comment threads
  • Video search
  • Channel members (requires approval from YouTube)

For collecting statistics about your own channel using the YouTube analytics API, see YTAAPI.


Example usage:

import asyncio
from SlyYTDAPI import *

async def main():
    # don't forget to keep your secrets secret!
    yt = YouTubeData(open('api_key.txt').read())

    my_video = await yt.video('dQw4w9WgXcQ')
    print(F"Check this out!\n{my_video.link()}")

    # keep it simple
    _ = await my_video.comments(limit=10) # list[Comment]

    # or opt in to generators
    print('\n---\n'.join([
        F"{c.author_name} > {c.body}"
        async for c in my_video.comments(limit=10)
    ]))
    
asyncio.run(main())

Access to YouTube Data API is free is limited by a quota. See YouTube's determine quota cost article for more information.

If you are using OAuth2 instead of an API Key, a CLI is provided to grant credentials to yourself:

# WINDOWS
py -m SlyYTDAPI grant
# MacOS or Linux
python3 -m SlyYTDAPI grant

Both methods require a Google Cloud Console account and project credentials. Please see https://docs.dunkyl.net/SlyAPI-Python/tutorial/oauth2.html for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slyytdapi-0.4.8.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

SlyYTDAPI-0.4.8-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file slyytdapi-0.4.8.tar.gz.

File metadata

  • Download URL: slyytdapi-0.4.8.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for slyytdapi-0.4.8.tar.gz
Algorithm Hash digest
SHA256 18a0a760b96bbbecbc107b5140868acff80c40737edf44a789b9da734df1888b
MD5 8a33e5a2b089d4ae88bde6754e630aa1
BLAKE2b-256 fa6c26a8fcc3f40ebdccde51d9faed2b217ebe286d8247a2f09920d0c3c3566b

See more details on using hashes here.

File details

Details for the file SlyYTDAPI-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: SlyYTDAPI-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for SlyYTDAPI-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 66a2ad10f1eddbc1e1b16838fd0c70a8087cc271ff30980abbeece65c275f8ca
MD5 8f7f596b3ab4824d4f53ae69411413f1
BLAKE2b-256 da2accc6d78c3975067d9227df5485b49db434212c0756e0d617c51afc6f79fe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page