description
Project description
garf for YouTube Data API
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 GARF_YOUTUBE_DATA_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-executorspackage 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 bygarf-iolibrary.<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
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_data_api-0.0.9.post0.tar.gz.
File metadata
- Download URL: garf_youtube_data_api-0.0.9.post0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15dde374afca4685ed64a8c4be35020be767c48616b83e4ffc1e2fb5b9b948b3
|
|
| MD5 |
dfc0f7a242eb23b913f4b552b1ee5274
|
|
| BLAKE2b-256 |
bd033d69ed1f41c0f520323d448ea109606be8fb569f7daa18cd5879e82833e9
|
File details
Details for the file garf_youtube_data_api-0.0.9.post0-py3-none-any.whl.
File metadata
- Download URL: garf_youtube_data_api-0.0.9.post0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe8c369d9bc527bb4a776b14f50365c6f45cec8e13cd0cb5d3f424e3f6bd4677
|
|
| MD5 |
07e61358bad7f25690cdc585c2ea0506
|
|
| BLAKE2b-256 |
833a75b83c24bab2d3bd9337ec4fca3cdd050e006eac1b4fa9807d45017316d8
|