Skip to main content

sly logo Sly YTAAPI for Python

🐍 For Python 3.10+

No boilerplate, async and typed Youtube Analytics API access. 😋

pip install slyytaapi

This library does not have full coverage. Currently, the following topics are supported:

  • Targeted queries for channels and videos

You can directly grant user tokens using the command line, covering the whole OAuth 2 grant process.


Example usage:

import asyncio
from datetime import date
from SlyYTAAPI import *

async def main():

    auth = OAuth2('test/app.json', 'test/user.json')
    analytics = YouTubeAnalytics('UCxATMl-Cv8BEF0FtZMRvRgA', auth)

    result = await analytics.query(
        since=date(2020, 1, 1),
        end_date=date(2021, 1, 1),
        metrics=Metrics.SubsGained+Metrics.SubsLost+Metrics.WatchTime,
        dims=Dimensions.Day
        )

    result.saveCSV('test/test.csv')

asyncio.run(main())

Example CLI usage for getting authorized:

# WINDOWS
py -m SlyYTAAPI grant
# MacOS or Linux
python3 -m SlyYTAAPI 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.

Metadata

Release files for SlyYTAAPI 0.2.0

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

Source distribution (sdist)

Source distribution for SlyYTAAPI 0.2.0
File Size Uploaded
SlyYTAAPI-0.2.0.tar.gz 5.5 kB Details

Built distribution (wheel)

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

Total release size: 11.9 kB

Release files / SlyYTAAPI-0.2.0.tar.gz

Download URL SlyYTAAPI-0.2.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f86da4ec7d2d304451f2daf1bae747472160c76dbb884cb768d786673b169f0e
BLAKE2b-256 checksum
How to use checksums
9878b64a9963d8acf4554c9879b0b8cc4c3c01e6014b2b5536fc827ccbe69ee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / SlyYTAAPI-0.2.0-py3-none-any.whl

Download URL SlyYTAAPI-0.2.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba016a87940688eb5c3bb696cd60644e513b60ffad151d1f3c703c9ae3fc4d30
BLAKE2b-256 checksum
How to use checksums
db513ade51c5d49d52e49fb9d1f67e6fd0a9f82c4d6fc53f5aa260e007154a14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

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