Skip to main content

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.

Metadata

Release files for SlyYTDAPI 0.4.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SlyYTDAPI 0.4.12
File Size Uploaded
slyytdapi-0.4.12.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SlyYTDAPI 0.4.12
File Interpreter ABI Platform
SlyYTDAPI-0.4.12-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / slyytdapi-0.4.12.tar.gz

Download URL slyytdapi-0.4.12.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3a092d60a0a46008bbaaba6d87d831beba7023cc9af130a2f4d2ad7e57bd5e00
BLAKE2b-256 checksum
How to use checksums
51d03d58a4d43f616fd5c7b3b5259c3413599fbc42ef5d6a2f7382f25dc84cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Release files / SlyYTDAPI-0.4.12-py3-none-any.whl

Download URL SlyYTDAPI-0.4.12-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2a84a4d6349e6865fbcf28f74b722445b278c0896d9f773dc6b15e1ce49aa3a
BLAKE2b-256 checksum
How to use checksums
337f4292ac38c11bb99f294f54733bf2f23021d6129ee9554f11a39d7e08d761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.4.12 This release

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page