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 and typed YouTube Data API access. 😋

pip install slyytdapi

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

  • Videos
  • 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())

Example CLI usage for getting authorized:

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

Granting credentials requires a Google Cloud Console account and JSON file. 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.4.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

SlyYTDAPI-0.4.4-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slyytdapi-0.4.4.tar.gz
  • Upload date:
  • Size: 12.6 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.4.tar.gz
Algorithm Hash digest
SHA256 0a92322e014db9d4a5190f0cff985300e5288c77a6588082090012f41d65ff8e
MD5 1f9e68506632059f4b8c1405a19a34f3
BLAKE2b-256 8b9600499b52e1733a581dcc7288887aa94df9b849ca633bed89231435d398bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SlyYTDAPI-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 12.0 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a3a29b665fb0a9c3f024ab6fc6ff4dd323739372a91f0a73ee6add4b27531b8e
MD5 754d664a06c6bee19029004e5973339e
BLAKE2b-256 fce18daa445a8dda20ab62f08ec9a8010197e852b8a011b1edc9f626df0cd59d

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