Skip to main content

No project description provided

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

garf_youtube_reporting_api-0.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

garf_youtube_reporting_api-0.0.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file garf_youtube_reporting_api-0.0.2.tar.gz.

File metadata

File hashes

Hashes for garf_youtube_reporting_api-0.0.2.tar.gz
Algorithm Hash digest
SHA256 50e5c3fdb8fd1c94ba940aa52a53aba871832d27b4b2a36b26223ed1180b3b7a
MD5 50f11c48ad7385331dca56c273962b65
BLAKE2b-256 e1ec5a29ab08492909894cc2b57381123364abc4b49af1de592ba334cf66490e

See more details on using hashes here.

File details

Details for the file garf_youtube_reporting_api-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for garf_youtube_reporting_api-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 75c0213118af03eab3840ebd3288d7fb6763802a51f62ad455e33bbf81a030d5
MD5 2529d7931e432e232633b84e8f4739ed
BLAKE2b-256 165405c45b5f4fbbbb3ee43a24cf6f916efee98c99d281eb22bc2e64c561ac52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page