npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aimasaou/ytcli

v1.0.0

Published

YouTube CLI Tool with multi-profile support

Readme

ytcli - YouTube CLI Tool

YouTubeの動画管理をコマンドラインから行うCLIツール。複数アカウント(プロファイル)対応。

機能

  • 動画のアップロード(サムネイル、予約公開対応)
  • 動画一覧の取得・検索
  • 動画メタデータの更新(タイトル、説明、タグ、公開状態)
  • チャンネル・動画のアナリティクス表示
  • 複数YouTubeアカウント(プロファイル)の切り替え
  • JSON出力対応(スクリプト連携用)

必要条件

  • Node.js 20.0.0 以上
  • Google Cloud Projectの作成とOAuth2認証情報

インストール

# npmからグローバルインストール
npm install -g @aimasaou/ytcli

# または、リポジトリからインストール
git clone https://github.com/MASAKASUNO1/ytcli.git
cd ytcli
npm install
npm link

クイックスタート

# 1. プロファイルを作成
ytcli profile create default

# 2. OAuth2認証情報を入力(対話形式)
#    Client IDとClient Secretを入力

# 3. YouTubeに認証
ytcli auth login

# 4. 動画一覧を確認
ytcli list

# 5. 動画をアップロード
ytcli upload video.mp4 -t "My Video"

OAuth2認証情報の取得

  1. Google Cloud Console にアクセス
  2. プロジェクトを作成(または選択)
  3. 「APIとサービス」→「ライブラリ」から以下を有効化:
    • YouTube Data API v3
    • YouTube Analytics API
  4. 「認証情報」→「認証情報を作成」→「OAuthクライアントID」
  5. アプリケーションの種類: 「デスクトップアプリ」
  6. 作成後、Client IDとClient Secretをコピー

コマンド一覧

認証 (auth)

# ログイン(OAuth2認証)
ytcli auth login [--profile <name>] [--force]

# ログアウト
ytcli auth logout [--profile <name>]

# 認証状態を確認
ytcli auth status [--profile <name>]

プロファイル管理 (profile)

# プロファイル一覧
ytcli profile list

# デフォルトプロファイルを切り替え
ytcli profile use <name>

# プロファイルを作成(対話形式)
ytcli profile create <name>

# プロファイルを作成(引数指定)
ytcli profile create <name> --client-id <id> --client-secret <secret>

# プロファイルを削除
ytcli profile delete <name>

# プロファイル詳細を表示
ytcli profile show [name]

動画操作

# 動画一覧を取得
ytcli list [-m, --max <number>] [-s, --status <status>] [--next-page-token <token>] [-q, --query <text>] [--json]

# 動画の詳細を取得
ytcli get <videoId> [--json]

# 動画のメタデータを更新
ytcli update <videoId> [-t, --title <title>] [-d, --description <desc>] [--tags <tags>] [--privacy <status>] [--thumbnail <path>]

# 動画をアップロード
ytcli upload <file> -t <title> [-d, --description <desc>] [--tags <tags>] [--privacy <status>] [--thumbnail <path>] [--category <id>] [--publish-at <datetime>]

アナリティクス

# チャンネル全体のアナリティクス
ytcli analytics [-d, --days <number>] [--json]

# 特定動画のアナリティクス
ytcli analytics <videoId> [-d, --days <number>] [--json]

チャンネル情報

# チャンネル情報を表示
ytcli channel [--json]

プロファイル選択の優先順位

  1. --profile <name> オプション
  2. YTCLI_PROFILE 環境変数
  3. ~/.cerberus/youtube-cli/.current-profile ファイル
  4. default プロファイル

プロファイル保存場所

~/.cerberus/youtube-cli/
├── profiles/
│   ├── default.json
│   └── work.json
└── .current-profile

カテゴリID一覧

| ID | カテゴリ | |----|----------| | 1 | Film & Animation | | 2 | Autos & Vehicles | | 10 | Music | | 15 | Pets & Animals | | 17 | Sports | | 19 | Travel & Events | | 20 | Gaming | | 22 | People & Blogs (default) | | 23 | Comedy | | 24 | Entertainment | | 25 | News & Politics | | 26 | Howto & Style | | 27 | Education | | 28 | Science & Technology | | 29 | Nonprofits & Activism |

# 基本的なアップロード(非公開)
ytcli upload video.mp4 -t "My Video"

# 説明・タグ付きで公開アップロード
ytcli upload video.mp4 -t "Tutorial" -d "Description here" --tags "AI,tutorial" --privacy public

# サムネイル付きでアップロード
ytcli upload video.mp4 -t "My Video" --thumbnail thumb.jpg

# 予約公開(日本時間)
ytcli upload video.mp4 -t "My Video" --publish-at "2030-12-25T09:00:00+09:00"

# JSON形式で動画一覧を取得
ytcli list --json

# 動画一覧を検索(取得したページ内)
ytcli list -m 50 --query "tutorial"

# 次ページを取得(表示されたトークンを利用)
ytcli list --next-page-token <TOKEN>

# 特定動画のタイトルを変更
ytcli update VIDEO_ID -t "New Title"

# 過去7日間のアナリティクス
ytcli analytics -d 7

# 別プロファイルで操作
ytcli list --profile work

環境変数

| 変数名 | 説明 | |--------|------| | YTCLI_PROFILE | 使用するプロファイル名を指定 |

トラブルシューティング

認証エラー(401/403)が発生する

# トークンを再取得
ytcli auth login --force

「プロファイルが見つかりません」エラー

# プロファイル一覧を確認
ytcli profile list

# プロファイルを作成
ytcli profile create default

YouTube Data API のクォータ制限

YouTube Data API には1日あたりのクォータ制限があります。大量のアップロードや頻繁なAPI呼び出しを行う場合は、Google Cloud Consoleでクォータ使用量を確認してください。

サムネイルのアップロードに失敗する

  • サポートされる形式: JPEG, PNG, GIF, BMP
  • 最大ファイルサイズ: 2MB
  • 推奨解像度: 1280x720 (16:9)

開発

# リポジトリをクローン
git clone https://github.com/MASAKASUNO1/ytcli.git
cd ytcli

# 依存関係をインストール
npm install

# CLIを実行
npm start -- list
# または
node bin/ytcli.js list

# テスト
npm test

ライセンス

MIT