Skip to main content

garf for YouTube Reporting API

PyPI Downloads PyPI

garf-youtube-reporting-api simplifies fetching data from YouTube Reporting API using SQL-like queries.

Prerequisites

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.readonly scope
    • Enter OAuth Client ID and OAuth Client secret under Use your own OAuth credentials;
    • Click on Authorize APIs
  • 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-executors package 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 by garf-io library.

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)

Source distribution for garf-youtube-reporting-api 0.0.2
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)

Table of built distributions (wheels) for garf-youtube-reporting-api 0.0.2
File Interpreter ABI Platform Actions
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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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