Skip to main content

CLI tool to manage and analyze your YouTube channel from the terminal

Project description

YT Studio CLI

CI PyPI Python License: MIT

Manage and analyze your YouTube channel from the terminal. Ideal for automation and AI workflows.

demo

Motivation

I built this because I needed to bulk update video titles for a YouTube channel I manage with 300+ videos. YouTube Studio does not support bulk search-replace operations, which made it a tedious manual process. This tool uses the YouTube Data API to perform bulk operations on video metadata. Furthermore, it provides features for analytics and comment moderation, all accesible from the command line.

Installation

I recommend the excellent uv tool for installation:

uv tool install ytstudio-cli

The CLI is installed as ytstudio; yts is a short alias for the same entry point.

Setup

  1. Create a Google Cloud project
  2. Enable YouTube Data API v3 and YouTube Analytics API
  3. Configure OAuth consent screen:
    • Go to APIs & ServicesOAuth consent screen
    • Select External and create
    • Fill in app name and your email
    • Skip scopes, then add yourself as a test user
    • Leave the app in "Testing" mode (no verification needed)
  4. Create OAuth credentials:
    • Go to APIs & ServicesCredentials
    • Click Create CredentialsOAuth client IDhow
    • Select Desktop app as application type
    • Download the JSON file
  5. Configure ytstudio:
ytstudio init --client-secrets path/to/client_secret_<id>.json
ytstudio login

Credentials stored in ~/.config/ytstudio-cli/.

Headless Linux login

If you are logging in from a server without a browser, run:

ytstudio login --headless

The command prints a Google OAuth URL. Open that URL in a browser on any machine and approve access. The browser will then fail to load a 127.0.0.1 page; this is expected. Copy the full URL from the browser address bar, paste it back into the terminal, and ytstudio will finish the login.

Managing multiple channels

If you run more than one YouTube channel, ytstudio stores each login under its own named profile. Every command (videos, analytics, comments, ...) operates on the active channel.

ytstudio profile add work       # authenticate a new channel and make it active
ytstudio profile add personal   # add another
ytstudio profile list           # show profiles; the active one is marked with *
ytstudio profile use work       # switch the active profile
ytstudio profile status work    # auth status for one profile (defaults to active)
ytstudio profile remove personal

For scripting you can override the active channel per command without switching:

YTSTUDIO_PROFILE=work ytstudio videos list

Credentials live in ~/.config/ytstudio-cli/profiles/<name>/ with owner-only (600) permissions. The shared OAuth client secrets stay at the top level, so ytstudio init is only needed once. A plain ytstudio login (no profile add) authenticates the active profile, which is default on a fresh setup. Existing single-channel installs are migrated to the default profile automatically on first run.

Live broadcasts

Manage your YouTube livestream broadcasts from the CLI. This drives YouTube's liveBroadcasts API (scheduling, starting, stopping, updating); the actual video push to YouTube still goes through your encoder of choice (OBS, etc.).

ytstudio livestreams list --status upcoming        # what is scheduled
ytstudio livestreams show <broadcast-id>           # details for one broadcast
ytstudio livestreams show <id> --ingest            # also fetch the bound stream's RTMP URL
ytstudio livestreams show <id> --show-key          # reveal the stream key (treat as secret)
ytstudio livestreams schedule \
    --title "Title" --scheduled-start 2026-06-01T19:00:00+02:00   # dry-run
ytstudio livestreams schedule ... --execute        # actually create
ytstudio livestreams start <id>                    # transition to live
ytstudio livestreams start <id> --to testing       # transition to the monitor stream first
ytstudio livestreams stop <id>                     # transition to complete
ytstudio livestreams update <id> --privacy unlisted --no-dvr   # dry-run by default

Notes:

  • schedule and update default to a dry-run preview; pass --execute to apply.
  • --show-key on show reveals the bound stream key; without it the key is redacted. Stream keys are credentials.
  • liveBroadcasts.insert/update are write operations (~50 quota units each); see API quota below.

API quota

The YouTube Data API enforces a default quota of 10_000 units per project per day. Most read operations (listing videos, comments, channel info) cost 1 unit, while write operations like updating video metadata or moderating comments cost 50 units each. Bulk updates can consume quota quickly. When exceeded, the API returns a 403 error; quota resets at midnight Pacific Time.

You can request a quota increase via IAM & AdminQuotas in the Google Cloud Console. See the official quota documentation for full details.

Disclaimer

This project is not affiliated with or endorsed by Google. YouTube and YouTube Studio are trademarks of Google. All channel data is accessed exclusively through the official YouTube Data API and YouTube Analytics API.

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

ytstudio_cli-0.2.0.tar.gz (722.6 kB view details)

Uploaded Source

Built Distribution

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

ytstudio_cli-0.2.0-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

Details for the file ytstudio_cli-0.2.0.tar.gz.

File metadata

  • Download URL: ytstudio_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 722.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ytstudio_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a187149526724d2608c610d07ef7dd75fc8a2e1b2bddb915ee410f6907ed6a7c
MD5 37690884582386e71245a5ff33d39d5e
BLAKE2b-256 0f8d00fa5c2200af49d074f1f990a22625c3a2e4feb9055103f325c1bc1327d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ytstudio_cli-0.2.0.tar.gz:

Publisher: ci.yml on jdwit/ytstudio-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ytstudio_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ytstudio_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 46.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ytstudio_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2950bcf749c6080fde97cf73a98e306411bc7ddfd6c2a9b4f58138d66ed290f5
MD5 58a5791e4a3269d72172764f87c5b50b
BLAKE2b-256 703d60cfb3db6dff92dc70c4178c2b6bbc858c66d5880760a576d36805399384

See more details on using hashes here.

Provenance

The following attestation bundles were made for ytstudio_cli-0.2.0-py3-none-any.whl:

Publisher: ci.yml on jdwit/ytstudio-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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