Skip to main content

YTM - YouTube Music CLI

🎵 A simple, interactive command-line tool for YouTube Music

Stream music directly from YouTube Music in your terminal with intuitive controls, playlist management, and smart filtering.

ytm-cli player demo

Player UI with the real-time FFT spectrum visualizer (synthetic demo capture). Click for the higher-quality .webm.

✨ Features

  • 🔍 Smart Search: Search and play any song from YouTube Music
  • 🎮 Interactive Controls: Play/pause, skip, go back with simple key presses
  • 📱 Vim-like Navigation: Use j/k keys or arrow keys to navigate
  • 📋 Local Playlists: Create and manage personal playlists
  • 👎 Smart Filtering: Dislike songs to filter them from future results
  • 📜 Synced Lyrics: Live-highlighted lyrics with auto-scroll (press l)
  • 🎯 Radio Mode: Automatic playlist generation based on your selection
  • 📊 Real-time Spectrum Visualizer: 24-band FFT bars in both player layouts, driven by an ffmpeg sidecar with animated fallback bars when live data is unavailable
  • 🤖 AI-Powered: Natural language music requests and AI-generated playlists

🚀 Quick Start

Requirements

  • Python 3.10+ (set in pyproject.toml)
  • mpv media player (must be installed system-wide)
  • ffmpeg on PATH for the real-time spectrum visualizer (optional — falls back to animated bars if missing)

Installation

One command with uv (recommended):

# Install from PyPI — gets latest version automatically
uvx ytm-cli "song name"
Alternative: clone and run locally
git clone https://github.com/thieuluan1618/ytm.git
cd ytm
uv run ytm-cli "song name"
Alternative: one-shot setup script (Linux / macOS)
git clone https://github.com/thieuluan1618/ytm.git
cd ytm
./setup.sh
source ~/.zshrc            # or ~/.bashrc for bash

This creates the venv, installs runtime deps from pyproject.toml, and adds a ytm shell alias.

Alternative: manual install
git clone https://github.com/thieuluan1618/ytm.git
cd ytm
uv sync                   # installs runtime deps from pyproject.toml + uv.lock
./setup_alias.sh          # optional: registers the `ytm` alias
# Run with: uv run ytm-cli "song"

Windows users: native Windows is not supported (the codebase uses POSIX-only termios/tty/fcntl). Use WSL2 and follow the Linux instructions above.

Basic Usage

Interactive search:

ytm-cli
# Enter search query when prompted

Direct search:

ytm-cli "your favorite song"

Non-interactive mode (automation/scripting):

ytm-cli search "song name" --select 1                     # Auto-select first result
ytm-cli search "song" -s 1 --verbose                      # With verbose output
ytm-cli search "song" -s 1 --verbose --log-file debug.log # Save debug logs
ytm-cli -v                                                # Print version
ytm-cli --update                                          # Update the app and dependencies

Tip: Set up the shell alias to use ytm as a shortcut for ytm-cli. See the setup scripts above.

🎮 Controls

During Song Selection

  • ↑/↓ or j/k - Navigate through results
  • Enter - Select and play song
  • q - Quit

During Playback

  • Space - Play/pause
  • n - Next song
  • b - Previous song
  • l - Show lyrics (synced highlighting with auto-scroll)
  • a - Add to playlist
  • d - Dislike song (skip and filter from future results)
  • q - Quit

During Lyrics View

  • j/k or ↑/↓ - Manual scroll
  • Space - Re-enable auto-scroll
  • q or Esc - Back to player
  • PgUp/PgDn - Page scroll
  • Home/End - Jump to top/bottom

📋 Playlist Management

Create and manage playlists:

ytm-cli playlist list              # List all playlists
ytm-cli playlist create            # Create new playlist
ytm-cli playlist show "My Songs"   # View playlist contents
ytm-cli playlist play "My Songs"   # Play entire playlist
ytm-cli playlist delete "My Songs" # Delete playlist

Add songs to playlists:

  • Press a during song selection or playback
  • Choose existing playlist or create new one
  • Song added without interrupting playback

🤖 AI Music Assistant

Use natural language to search and create playlists powered by AI (supports Google Gemini, OpenAI, Anthropic):

ytm-cli llm ask "play something chill for studying"       # AI picks and auto-plays
ytm-cli llm ask "upbeat pop songs for a workout"           # Natural language search
ytm-cli llm playlist "lo-fi beats for rainy days" --play   # AI-generated playlist
ytm-cli llm playlist "90s rock classics" -n 20             # 20-song playlist

Configure your provider in config.ini:

[llm]
provider = google       # google, openai, or anthropic
model = gemini-2.5-pro

🛠️ Configuration

The app uses config.ini for customization:

[general]
songs_to_display = 10
show_thumbnails = true

[mpv]
# Add custom mpv flags
flags = --no-video

[playlists]
directory = playlists

🎯 Philosophy

Keep it simple for the listener to enjoy music. Features are designed to be:

  • Intuitive: Single-key shortcuts during playback
  • Non-disruptive: Actions don't interrupt your listening experience
  • Consistent: Same navigation patterns across all screens
  • Quick: Important features accessible with simple key presses

🐛 Troubleshooting

Having issues? Check out the Troubleshooting Guide for solutions to common problems:

Quick diagnosis:

# Enable verbose logging to see what's happening
ytm-cli search "test" -s 1 --verbose --log-file debug.log

# Check versions
mpv --version
yt-dlp --version

📄 License

This project is open source. Please check the license file for details.


Enjoy your music! 🎵

Download files

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

Source Distribution

ytm_cli-0.11.0.tar.gz (93.5 kB view details)

Uploaded Source

Built Distribution

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

ytm_cli-0.11.0-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

Details for the file ytm_cli-0.11.0.tar.gz.

File metadata

  • Download URL: ytm_cli-0.11.0.tar.gz
  • Upload date:
  • Size: 93.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ytm_cli-0.11.0.tar.gz
Algorithm Hash digest
SHA256 682da9061ab733ef38c4b03fc2b35f4465e87f626ff70f341bc6a064b1126236
MD5 cdff4215bdc8c60499e9704057627b69
BLAKE2b-256 836282948aa8f73e76d20a8e6afc2ebc9cdaccf460ad87a6cf3d0c0e1669d767

See more details on using hashes here.

Provenance

The following attestation bundles were made for ytm_cli-0.11.0.tar.gz:

Publisher: publish.yml on thieuluan1618/ytm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ytm_cli-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: ytm_cli-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 64.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ytm_cli-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ef87b24c4231b57dea8d2f6d753052c7e4693b20a25dce1757d73bdc94dcbc7
MD5 0896c6c219154ef05c111b24a2d9a8ea
BLAKE2b-256 a856821ba18dc36266aee9a3e602b4e5b1a8e341dd6bed232382051c8ba5a822

See more details on using hashes here.

Provenance

The following attestation bundles were made for ytm_cli-0.11.0-py3-none-any.whl:

Publisher: publish.yml on thieuluan1618/ytm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

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