Skip to main content

YouTube CLI uploader

This is a small Python client for uploading videos to an owned YouTube channel through the YouTube Data API v3. It uses OAuth authorization, resumable uploads, and private uploads by default.

The uploader can send a title, description, tags, category, language, audience setting, synthetic media disclosure, thumbnail, and caption track. It then checks YouTube until processing succeeds.

Installation

Install the CLI from PyPI with uv:

uv tool install youtube-cli-uploader

This installs the youtube-upload and youtube-authorize commands.

Authorization

Create an OAuth desktop client in Google Cloud for a project with the YouTube Data API v3 enabled. Download the client JSON to:

~/.config/youtube-api-uploader/client_secret.json

Authorize the channel:

youtube-authorize

Authorization prints the channel title, ID, and URL. On a headless host, forward the selected port over SSH and run authorization with --no-browser --port PORT.

Upload

youtube-upload video.mp4 \
  --title "Example upload" \
  --description-file description.txt \
  --tag example \
  --thumbnail thumbnail.jpg \
  --captions captions.srt \
  --contains-synthetic-media

Uploads are private unless --privacy unlisted or --privacy public is provided. API projects that have not completed YouTube's compliance audit may be restricted to private uploads.

The uploader saves the video ID and completed steps beside the video in VIDEO.youtube-upload.json. Run the same command again after a failure to resume the existing upload instead of creating a duplicate. Use --state PATH to choose another state location.

Example

example/ contains a ready-to-upload private test with a 5.2 KB MP4, thumbnail, description, and captions.

API operations

  • videos.insert creates the video, sends its metadata, and uploads the MP4 in resumable chunks.
  • thumbnails.set attaches the optional JPEG thumbnail.
  • videos.list checks upload and processing status.
  • captions.insert attaches the optional caption file after video processing succeeds.
  • captions.list checks that the caption track reaches serving status.

The client requests the youtube.upload and youtube.force-ssl OAuth scopes. OAuth client secrets and user tokens remain in the local configuration directory and are excluded from Git.

Tests

uv --no-config run --locked python -m unittest discover -s tests
uv --no-config build --no-sources

Data handling

The scripts run locally and communicate directly with Google's OAuth and YouTube API endpoints. They do not operate a server, collect analytics, or send video data or credentials to any other service. OAuth tokens and upload state are stored locally with owner-only permissions. Revoking the app in the Google Account permissions page disables future access.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youtube_cli_uploader-0.1.0.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

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

youtube_cli_uploader-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file youtube_cli_uploader-0.1.0.tar.gz.

File metadata

  • Download URL: youtube_cli_uploader-0.1.0.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for youtube_cli_uploader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5df909a010a5d8ba7602e20ac9798378a6f8a4dff3fafe68e920b32ea2ba7993
MD5 f6da9e276f6b4eec507ac6725d5c18e1
BLAKE2b-256 c1a0f180f46c942c93d0762a41dca277b02f0646d06aae274ec9641eb5b9024a

See more details on using hashes here.

File details

Details for the file youtube_cli_uploader-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: youtube_cli_uploader-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for youtube_cli_uploader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77b7ed2904a3cfacdb58b596804ba85533338a3ba4ebd7735376b36da7521ef2
MD5 5bf89607f89e1ff124073f98fde10cc4
BLAKE2b-256 51e555b7b4ec0e0b4e01fed85f685562c512c9885bc781e34f8d1c01af56a3d5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page