This repository contains code examples and instructions on using YouTube Analytics and Reporting APIs to unlock insights from your YouTube channel data. The examples demonstrate setting up API credentials using a service account and accessing key metrics like video views and custom reports.
For additional insights and practical use cases, please see this article on YouTube Analytics and Reporting API Guide.
git clone https://github.com/your-username/YouTube-Analytics-and-Reporting-APIs.git
cd YouTube-Analytics-and-Reporting-APIs
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of your service account key:
set GOOGLE_APPLICATION_CREDENTIALS=path\to\your\service-account-file.json
Run the Python script read.py to retrieve video views:
python analyze.py
Run the script to create and download custom reports:
python report.py
If you would like more information on generating custom reports, please refer to the practical guide in this article.