garf for YouTube Reporting API
garf-youtube-reporting-api simplifies fetching data from YouTube Reporting API using SQL-like queries.
Prerequisites
- YouTube Reporting API enabled.
- Client ID, client secret and refresh token generated. \
Please note you'll need to use another OAuth2 credentials type - Web application, and set "https://developers.google.com/oauthplayground" as redirect url in it.
-
Refresh token. You can use OAuth Playground to generate refresh token.
- Select
https://www.googleapis.com/auth/yt-analytics.readonlyscope - Enter OAuth Client ID and OAuth Client secret under Use your own OAuth credentials;
- Click on Authorize APIs
- Select
-
Expose client id, client secret and refresh token as environmental variables:
export YT_CLIENT_ID=
export YT_CLIENT_SECRET=
export YT_REFRESH_TOKEN=
Installation
pip install garf-youtube-reporting-api
Usage
Run as a library
from garf_youtube_data_api import report_fetcher
from garf_io import writer
# Specify query
query = """
SELECT
dimensions.day AS date,
metrics.views AS views
FROM channel
WHERE
channel==MINE
AND startDate = 2010-01-01
AND endDate = 2024-01-01
"""
# Fetch report
fetched_report = report_fetcher.YouTubeReportingApiReportFetcher().fetch(query)
# Write report to console
console_writer = writer.create_writer('console')
console_writer.write(fetched_report, 'output')
Run via CLI
Install
garf-executorspackage to run queries via CLI (pip install garf-executors).
garf <PATH_TO_QUERIES> --source youtube-reporting-api \
--output <OUTPUT_TYPE> \
where:
<PATH_TO_QUERIES>- local or remove files containing queries<OUTPUT_TYPE>- output supported bygarf-iolibrary.
Metadata
Release files for garf-youtube-reporting-api 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| garf_youtube_reporting_api-0.0.2.tar.gz | 4.4 kB | Without provenance | Details for garf_youtube_reporting_api-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| garf_youtube_reporting_api-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for garf_youtube_reporting_api-0.0.2-py3-none-any.whl |
Total release size: 11.5 kB
Release files / garf_youtube_reporting_api-0.0.2.tar.gz
| Download URL | garf_youtube_reporting_api-0.0.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50e5c3fdb8fd1c94ba940aa52a53aba871832d27b4b2a36b26223ed1180b3b7a
|
|
BLAKE2b-256 checksum How to use checksums |
e1ec5a29ab08492909894cc2b57381123364abc4b49af1de592ba334cf66490e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / garf_youtube_reporting_api-0.0.2-py3-none-any.whl
| Download URL | garf_youtube_reporting_api-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75c0213118af03eab3840ebd3288d7fb6763802a51f62ad455e33bbf81a030d5
|
|
BLAKE2b-256 checksum How to use checksums |
165405c45b5f4fbbbb3ee43a24cf6f916efee98c99d281eb22bc2e64c561ac52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for garf-youtube-reporting-api 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.