No project description provided
Project description
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file garf_youtube_reporting_api-0.0.2.tar.gz.
File metadata
- Download URL: garf_youtube_reporting_api-0.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50e5c3fdb8fd1c94ba940aa52a53aba871832d27b4b2a36b26223ed1180b3b7a
|
|
| MD5 |
50f11c48ad7385331dca56c273962b65
|
|
| BLAKE2b-256 |
e1ec5a29ab08492909894cc2b57381123364abc4b49af1de592ba334cf66490e
|
File details
Details for the file garf_youtube_reporting_api-0.0.2-py3-none-any.whl.
File metadata
- Download URL: garf_youtube_reporting_api-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75c0213118af03eab3840ebd3288d7fb6763802a51f62ad455e33bbf81a030d5
|
|
| MD5 |
2529d7931e432e232633b84e8f4739ed
|
|
| BLAKE2b-256 |
165405c45b5f4fbbbb3ee43a24cf6f916efee98c99d281eb22bc2e64c561ac52
|