yt

yt

A Crystal CLI tool for YouTube management.

Author

Rénich Bon Ćirić renich@woralelandia.com

Version

0.2.0

License

GPLv3

Installation

  1. Clone the repository:
    git clone https://github.com/renich/yt.git
    cd yt
    
  2. Install dependencies:
    shards install
    
  3. Build the binary:
    shards build
    

This creates the ./bin/yt executable.

Usage

Show version:

./bin/yt --version

Authentication

To perform write operations (upload, update, delete) or access private data, you must authenticate using OAuth 2.0.

The authentication process is simple and automatic. The tool stores your credentials in a config file at ~/.config/yt/config.yml and handles the OAuth callback automatically.

Setup

  1. Create a project in the Google Cloud Console.

  2. Enable the YouTube Data API v3.

  3. Create OAuth 2.0 credentials (Client ID and Client Secret).

  4. Run the authentication command:

    ./bin/yt auth --id="YOUR_CLIENT_ID" --secret="YOUR_CLIENT_SECRET"
    

    This will:

    • Start a local HTTP server on port 1234
    • Open a browser for you to authorize the application
    • Automatically capture the OAuth callback
    • Store the tokens in ~/.config/yt/config.yml

Custom Port

If you need to use a different port:

./bin/yt auth --id="YOUR_CLIENT_ID" --secret="YOUR_CLIENT_SECRET" --port=8080

Token Management

  • Tokens are automatically stored in ~/.config/yt/config.yml
  • Access tokens are automatically refreshed when expired
  • No need to manually manage environment variables

API Key Usage

For read-only access using an API key (no authentication required):

./bin/yt list --key="your_api_key"

Listing Videos

To list your YouTube videos (uses config file after authentication):

./bin/yt list

Or using an API key (read-only for public data):

./bin/yt list --key="your_api_key"

Or using a custom access token (overrides config):

./bin/yt list --token="your_access_token"

Uploading a Video

To upload a new video:

./bin/yt upload path/to/video.mp4 --title="My Video Title" --description="Description here" --privacy="private"

Requires OAuth2 authentication.

Updating a Video

To update a video's metadata:

./bin/yt update VIDEO_ID --title="New Title" --privacy="public"

Requires OAuth2 authentication.

Deleting a Video

To delete a video:

./bin/yt delete VIDEO_ID

To delete without confirmation:

./bin/yt delete VIDEO_ID --force

Requires OAuth2 authentication.

Development

Run tests:

SPEC=true crystal spec

Run linter:

ameba

Format code:

crystal tool format

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

GPLv3 - see LICENSE file for details.

Repository

yt

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 4
  • about 15 hours ago
  • December 25, 2025
License

GNU General Public License v3.0 or later

Links
Synced at

Fri, 26 Dec 2025 05:49:30 GMT

Languages