Skip to content

eat-pray-ai/yutu

Repository files navigation

Yutu

yutu

Static Badge Go Report Card GitHub License Go Reference

GitHub Release GitHub Downloads GitHub Actions build Status GitHub Actions CodeQL Status GitHub Actions test Status

yutu - build a fully automated YouTube Channel!

yutu is a fully functional CLI for YouTube.

Prerequisites

Before you begin, an account on Google Cloud Platform is required to create a Project and enable these APIs for this project, in APIs & Services -> Enable APIs and services -> + ENABLE APIS AND SERVICES

After enabling the APIs, create an OAuth content screen with yourself as test user, then create an OAuth Client ID of type Web Application with http://localhost:8216 as the redirect URI.

Download this credential to your local machine with name client_secret.json, it should look like

{
  "web": {
    "client_id": "11181119.apps.googleusercontent.com",
    "project_id": "yutu-11181119",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_secret": "XXXXXXXXXXXXXXXX",
    "redirect_uris": [
      "http://localhost:8216"
    ]
  }
}

To verify this credential, run the following command

❯ yutu auth --credential client_secret.json

A browser window will open asking for your permission to access your YouTube account, after granting the permission, a token will be generated and saved to youtube.token.json.

{
  "access_token": "ya29.XXXXXXXXX",
  "token_type":"Bearer",
  "refresh_token":"1//XXXXXXXXXX",
  "expiry":"2024-05-26T18:49:56.1911165+08:00"
}

By default, yutu will read client_secret.json and youtube.token.json from the current directory, --credential/-c and --cacheToken/-t flags are available only in auth subcommand. To modify the default path in all subcommands, set these environment variables

export YUTU_CREDENTIAL=client_secret.json
❯ export YUTU_CACHE_TOKEN=youtube.token.json
# or
❯ YUTU_CREDENTIAL=client_secret.json YUTU_CACHE_TOKEN=youtube.token.json yutu subcommand --flag value

Installation

You can download yutu from releases page directly, or use the following methods as you prefer.

GitHub Actions

There are two actions available for yutu, one is for general purpose and the other is for uploading video to YouTube. Refer to youtube-action and youtube-uploader for more information.

Docker

❯ docker pull ghcr.io/eat-pray-ai/yutu:latest
❯ docker run --rm ghcr.io/eat-pray-ai/yutu:latest

Gopher

❯ go install github.com/eat-pray-ai/yutu@latest

Linux

❯ curl -sSfL https://github.com/eat-pray-ai/yutu/releases/latest/download/yutu-linux-$(uname -m) -o /usr/local/bin/yutu
❯ chmod +x /usr/local/bin/yutu

macOS

Homebrew is not available since this repository is not notable enough, star this repository to make it available on Homebrew.

❯ curl -sSfL https://github.com/eat-pray-ai/yutu/releases/latest/download/yutu-darwin-$(uname -m) -o /usr/local/bin/yutu
❯ chmod +x /usr/local/bin/yutu

Windows

❯ winget install yutu

Verifying Installation

Verify the integrity and provenance of yutu using its associated cryptographically signed attestations.

# Docker
❯ gh attestation verify oci://ghcr.io/eat-pray-ai/yutu:latest --repo eat-pray-ai/yutu

# macOS and Linux
❯ gh attestation verify $(which yutu) --repo eat-pray-ai/yutu

# Windows
❯ gh attestation verify $(where.exe yutu.exe) --repo eat-pray-ai/yutu

Usage

❯ yutu help
yutu is a fully functional CLI for YouTube, which can be used to manipulate YouTube videos, playlists, channels, etc.

Usage:
  yutu [flags]
  yutu [command]

Available Commands:
  activity               List YouTube activities
  auth                   Authenticate with YouTube API
  caption                Manipulate YouTube captions
  channel                Manipulate YouTube channels
  channelBanner          Insert Youtube channelBanner
  channelSection         Manipulate channel section
  comment                Manipulate YouTube comments
  commentThread          Manipulate YouTube comment threads
  completion             Generate the autocompletion script for the specified shell
  help                   Help about any command
  i18nLanguage           List YouTube i18nLanguages
  i18nRegion             List YouTube i18nRegions
  member                 List YouTube members
  membershipsLevel       List YouTube memberships levels
  playlist               Manipulate YouTube playlists
  playlistItem           Manipulate YouTube playlist items
  search                 Search for Youtube resources
  subscription           Manipulate YouTube subscriptions
  thumbnail              Set thumbnail for a video
  version                Show the version of yutu
  video                  Manipulate YouTube videos
  videoAbuseReportReason List YouTube video abuse report reasons
  videoCategory          List YouTube video categories
  watermark              Manipulate Youtube watermarks

Flags:
  -h, --help   help for yutu

Use "yutu [command] --help" for more information about a command.

Features

Please refer to FEATURES.md for more information.

Contributing

Please refer to CONTRIBUTING.md for more information.

Star History

Star History Chart