A helper script for getting YouTube analytic reports.
In order to run the script, you need to have the following:
- Python >= 3.8.0, < 3.9.0
- A Google Developers project with the YouTube Analytics API enabled
It is recommended you create a virtual environment for the project.
On UNIX-based systems:
python3.8 -m venv .venv
source ./.venv/bin/activate
On Windows:
py -3.8 -m venv .venv
./.venv/Scripts/activate
- Follow the instructions on the YouTube Analytics API docs.
- Download your secrets file to
data/secrets.json
.
You will need to install the script's dependencies before running it.
- Install Poetry
- Run the following command, making sure the virtual environment is activated:
poetry install --no-dev
If you prefer not to use Poetry, you can install using pip instead:
pip install google google-api-python-client google-auth-oauthlib pandas
- Change directory into the
scripts
directory. - To see what options you can parse, run:
python retrieve_analytics.py -h
- Run the script with the desired options.
- Open the provided link in the browser, and follow the on-screen instructions.
- Copy the provided code into the terminal, and press ENTER.
In order to contribute to the project, you will need to install the development dependencies.
Using Poetry:
poetry install
Using pip:
pip install google google-api-python-client google-auth-oauthlib pandas black mypy
Before submitting any code, make sure to run the following command in the root directory of the project:
black . -l119