Skip to main content

description

Project description

garf for YouTube Data API

PyPI Downloads PyPI

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

Prerequisites

  • YouTube Data API enabled.
  • API key to access to access YouTube Data API.

    Once generated expose API key as export GOOGLE_API_KEY=<YOUR_API_KEY>

Installation

pip install garf-youtube-data-api

Usage

Run as a library

from garf_youtube_data_api import report_fetcher
from garf_io import writer


# Specify query
query = 'SELECT id, snippet.title AS channel_name FROM channels'

# Fetch report
fetched_report = (
  report_fetcher.YouTubeDataApiReportFetcher()
  .fetch(query, id=[<YOUR_CHANNEL_ID_HERE>])
)

# 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-data-api \
  --output <OUTPUT_TYPE> \
  --source.<SOURCE_PARAMETER=VALUE>

where:

  • <PATH_TO_QUERIES> - local or remove files containing queries
  • <OUTPUT_TYPE> - output supported by garf-io library.
  • <SOURCE_PARAMETER=VALUE - key-value pairs to refine fetching, check available source parameters.

Available source parameters

name values comments
id id of YouTube channel or videos Multiple ids are supported, should be comma-separated
forHandle YouTube channel handle i.e. @myChannel
forUsername YouTube channel name i.e. myChannel
regionCode ISO 3166-1 alpha-2 country code i.e. US
chart mostPopular Gets most popular in regionCode, can be narrowed down with videoCategoriId

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_data_api-0.0.8.tar.gz (4.7 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_data_api-0.0.8-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file garf_youtube_data_api-0.0.8.tar.gz.

File metadata

File hashes

Hashes for garf_youtube_data_api-0.0.8.tar.gz
Algorithm Hash digest
SHA256 bab73f4e9e88eebdec5e809d2a8897a5e981d0d7f7a84756ed57e9946055b8f3
MD5 3e2a2301163319a05f70030cd17e155f
BLAKE2b-256 2c5355f60d84aacdc170e3247d32240ead72a89d71cc483f415e260fe8227f94

See more details on using hashes here.

File details

Details for the file garf_youtube_data_api-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for garf_youtube_data_api-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c836751d9595f2cbe5b0a81f6f1b2e633b14053d96e0516bab1866e563be6dda
MD5 8513df9a3455a40b36ed791db3020297
BLAKE2b-256 c4e1f61986f02e013bc6d288cbf8256b3df383af93740a7bb5752cf428c9bc77

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