Metadata-Version: 2.4
Name: yt-summarize-cli
Version: 0.1.0
Summary: YouTube playlist, caption, summary, and transcription CLI
Project-URL: Repository, https://github.com/hoishing/yt-cli
Requires-Python: >=3.14
Requires-Dist: google-auth-oauthlib>=1.3.1
Requires-Dist: google-auth>=2.49.2
Requires-Dist: google-genai>=1.73.1
Requires-Dist: httpx>=0.28.1
Requires-Dist: inquirerpy>=0.3.4
Requires-Dist: platformdirs>=4.9.6
Requires-Dist: pydantic-settings>=2.14.0
Requires-Dist: pytest>=9.0.3
Requires-Dist: rich>=15.0.0
Requires-Dist: typer>=0.24.2
Requires-Dist: wcwidth>=0.6.0
Requires-Dist: youtube-transcript-api>=1.2.4
Requires-Dist: yt-dlp>=2026.3.17
Description-Content-Type: text/markdown

# yt-cli

YouTube playlist, caption, summary, and transcription CLI

## Usage

Install the PyPI package, then run the `yt-cli` command:

```bash
uv tool install yt-summarize-cli
```

```bash
yt-cli --help
yt-cli --version
```

Create an OAuth desktop client in Google Cloud Console, enable the YouTube Data API v3, then sign in:

```bash
yt-cli auth login --client-secrets client_secret.json --scopes readonly
```

For caption-management permissions on videos you own:

```bash
yt-cli auth login --client-secrets client_secret.json --scopes captions
```

Run without arguments to open the interactive prompt flow:

```bash
yt-cli
```

In the video selector, use `Space` to select videos for deletion, `d` to delete selected videos from the playlist, and `Enter` to open the focused video. Playlist deletion needs a token created with write-capable scopes, for example:

```bash
yt-cli auth login --client-secrets client_secret.json --scopes manage
```

Core commands:

```bash
yt-cli auth status
yt-cli playlists list --include-special
yt-cli playlists videos PLAYLIST_ID --limit 25 --format json
yt-cli captions list VIDEO_ID
yt-cli captions summarize VIDEO_ID --to zh-TW
yt-cli transcribe VIDEO_ID --to ja
```

Watch Later is not exposed by the official YouTube Data API. Use the hybrid fallback command with browser cookies:

```bash
yt-cli watch-later videos --cookies-from-browser chrome --limit 25
```

Official caption downloads require permission to edit the video. For arbitrary videos, the CLI falls back to public transcripts when available, then audio transcription for `transcribe`.

## Development

```bash
uv sync
uv run yt-cli --help
uv run yt-cli --version
uv run yt-cli
uv run pytest
uv build --no-sources
```

Run opt-in live YouTube checks with a stored OAuth token or `YT_CLI_GOOGLE_ACCESS_TOKEN`:

```bash
YT_CLI_LIVE=1 uv run pytest tests/e2e/test_live_optional.py -rs
```

Provider defaults live in `src/yt_cli/default_settings.json`. Put secrets and local overrides in `.env`. The local `.env` may include `PYPI_API` for publishing, but never print or commit secret values.

## Provider Notes

When `.env` is present, the CLI reads provider settings from it after loading tracked defaults. API keys are never stored in `default_settings.json`.

Supported `.env` names:

- `GOOGLE_API`, `GOOGLE_MODEL`, `GOOGLE_TRANSCRIBE_MODEL`
- `NVIDIA_API`, `NVIDIA_BASE_URL`, `NVIDIA_MODEL`
- `OPENROUTER_API`, `OPENROUTER_BASE_URL`, `OPENROUTER_MODEL`

Multiple API keys are comma-separated in the provider API variable. Numbered keys such as `GOOGLE_API1` are ignored.

Summarization randomly selects one configured provider with keys, model, and required endpoint, then randomly selects one key for that request. Google summaries use `google-genai`; NVIDIA and OpenRouter use OpenAI-compatible `/chat/completions`.

Transcription is Google-only. The CLI first uses public captions when available, then uses the official `google-genai` SDK, uploads normalized audio through the Files API, and calls `models.generate_content`. Google transcription retries another comma-separated Google key when one is out of quota.

```bash
GOOGLE_API="key-a,key-b" \
GOOGLE_MODEL="gemma-4-31b-it" \
GOOGLE_TRANSCRIBE_MODEL="gemini-3.1-flash-lite-preview" \
yt-cli transcribe VIDEO_ID --to zh-TW
```

## Tests

The project uses e2e tests only.

```bash
uv run pytest
```

The default suite runs the real CLI subprocess against local mocked YouTube and LLM endpoints. Live tests can be added behind explicit environment gates without changing the default deterministic suite.
