No-boilerplate, async and typed YouTube Analytics API access.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SlyYTAAPI-0.2.0.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file SlyYTAAPI-0.2.0.tar.gz
.
File metadata
- Download URL: SlyYTAAPI-0.2.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f86da4ec7d2d304451f2daf1bae747472160c76dbb884cb768d786673b169f0e |
|
MD5 | 4baafe8d7fc148cc19d87e45d436d82d |
|
BLAKE2b-256 | 9878b64a9963d8acf4554c9879b0b8cc4c3c01e6014b2b5536fc827ccbe69ee1 |
File details
Details for the file SlyYTAAPI-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: SlyYTAAPI-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba016a87940688eb5c3bb696cd60644e513b60ffad151d1f3c703c9ae3fc4d30 |
|
MD5 | 6d2456ed0a0b1007e00362a4cda5127d |
|
BLAKE2b-256 | db513ade51c5d49d52e49fb9d1f67e6fd0a9f82c4d6fc53f5aa260e007154a14 |