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.3.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

SlyYTDAPI-0.3.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file SlyYTDAPI-0.3.1.tar.gz.

File metadata

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

File hashes

Hashes for SlyYTDAPI-0.3.1.tar.gz
Algorithm Hash digest
SHA256 137cfcb55efe0be263003f22918e8dbf6f90a4af51286a986850c46375cc2580
MD5 ffa689ea5ef745a2a8f816c8a125ac4d
BLAKE2b-256 c6c5b0b326396c3d56ea94ccb9e6c1232ad1625d4702dd1be4c3f5b9c09b8bef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SlyYTDAPI-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 065adb2de5ef3dd198c5099616997d3ee86677059bdc10366d2a06cfcddd7b8d
MD5 2f8e54d873a9491d4374543c96bbbdae
BLAKE2b-256 d6b833c02dc7e66caa304798ea406132372d815d14629d85f08090027e7a1b67

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