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 hashes)
Built Distribution
Close
Hashes for SlyYTAAPI-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba016a87940688eb5c3bb696cd60644e513b60ffad151d1f3c703c9ae3fc4d30 |
|
MD5 | 6d2456ed0a0b1007e00362a4cda5127d |
|
BLAKE2b-256 | db513ade51c5d49d52e49fb9d1f67e6fd0a9f82c4d6fc53f5aa260e007154a14 |