{
  "schemaVersion": "1.0",
  "item": {
    "slug": "ytm-cast",
    "name": "YouTube Music Cast",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/AidanTheBandit/ytm-cast",
    "canonicalUrl": "https://clawhub.ai/AidanTheBandit/ytm-cast",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/ytm-cast",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=ytm-cast",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/ytm-cast"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/ytm-cast",
    "agentPageUrl": "https://openagent3.xyz/skills/ytm-cast/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ytm-cast/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ytm-cast/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "YouTube Music Cast",
        "body": "YouTube music → your Chromecast. Simple, free, works.\n\nDownload audio from YouTube or YouTube Music and stream it through Home Assistant to any Cast-enabled device. No subscriptions, no cloud services, just your local network."
      },
      {
        "title": "Features",
        "body": "✅ Free forever — No subscriptions, no premium accounts needed\n✅ High quality — 320K MP3, crystal clear audio\n✅ Video mode — Create MP4 videos with album art and text overlays\n✅ Radio mode — Auto-discover and play related songs\n✅ Local storage — Your music stays on your machine, no cloud\n✅ Multi-room — Cast to any Chromecast device in your home\n✅ Batch download — Download entire playlists, stream anytime\n✅ Simple CLI — Fast commands, no browser required\n✅ Works offline — Once downloaded, music is yours to keep"
      },
      {
        "title": "Daily Music",
        "body": "Download your favorite tracks in the morning, cast them throughout the day. No waiting, no buffering."
      },
      {
        "title": "Party Mode",
        "body": "Download a playlist before guests arrive, then queue up songs without fumbling with phones or apps."
      },
      {
        "title": "Background Audio",
        "body": "Play ambient music or podcasts while you work without worrying about ads or interruptions."
      },
      {
        "title": "Multi-Room Sync",
        "body": "Stream the same track to multiple Chromecasts simultaneously (bedroom + living room + kitchen)."
      },
      {
        "title": "Why This Over Premium Services?",
        "body": "FeatureYouTube Music CastSpotify PremiumYouTube PremiumCostFree forever$10.99/month$13.99/monthQuality320K MP3Up to 320KUp to 1080p videoOfflineYes, foreverDownload limitDownload limitAdsNoneNoneNonePlatformsAny ChromecastSpotify Connect devicesYouTube appsPrivacyLocal onlyCloud-basedCloud-based"
      },
      {
        "title": "Quick Start",
        "body": "# 1. Setup (one time, takes 2 minutes)\ncast-setup\n\n# 2. Download your first song\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# 3. Start the web server\ncast-server start\n\n# 4. Cast it to your default device\ncast-play never-gonna-give-you-up.mp3\n\nThat's it. Your music is playing through your Chromecast."
      },
      {
        "title": "What This Does",
        "body": "Three simple steps, one command each:"
      },
      {
        "title": "1. Download",
        "body": "yt-dlp grabs audio from YouTube or YouTube Music, extracts it as MP3 (320K quality)."
      },
      {
        "title": "2. Host",
        "body": "A lightweight Python HTTP server makes your downloaded files accessible over your local network. No setup required — just Python 3."
      },
      {
        "title": "3. Cast",
        "body": "Home Assistant's media_player.play_media service sends the HTTP URL to your Chromecast, which streams the audio."
      },
      {
        "title": "Why a Web Server?",
        "body": "Home Assistant's play_media service requires a URL, not a file path. The web server bridges that gap.\n\n# ✅ This works — HA can fetch via HTTP\nmedia_content_id: \"http://192.168.1.81:8735/song.mp3\"\n\n# ❌ This fails — HA can't read file paths\nmedia_content_id: \"/tmp/youtube-music/song.mp3\"\n\nArchitecture:\n\nYouTube URL → yt-dlp → MP3 file → Python HTTP server → Home Assistant API → Chromecast"
      },
      {
        "title": "What You Need",
        "body": "Home Assistant with Google Cast integration\nChromecast or Cast-enabled device (Nest speakers, Google Home, TV)\nSystem tools: yt-dlp, Python 3, curl, jq"
      },
      {
        "title": "Step 1: Install Scripts",
        "body": "# Clone or download the skill\ncd youtube-music-cast\n\n# Make all scripts executable\nchmod +x scripts/*\n\n# Install globally (recommended)\n./install.sh --global\n\n# Or install locally\n./install.sh"
      },
      {
        "title": "Step 2: Run Setup Wizard",
        "body": "cast-setup\n\nThe wizard will ask for:\n\nHome Assistant URL — e.g., http://homeassistant.local:8123\nLong-Lived Access Token — Generate in HA → Profile → Long-Lived Access Tokens\nServer IP — The machine running these scripts\nDefault media player — e.g., media_player.bedroom_display"
      },
      {
        "title": "Step 3: Test Your Setup",
        "body": "# Download a test song\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# Start the server\ncast-server start\n\n# Cast it\ncast-play song.mp3\n\nIf music plays, you're ready!"
      },
      {
        "title": "Commands",
        "body": "CommandDescriptionExamplecast-setupRun configuration wizardcast-setupcast-download <URL> [options]Download from YouTube/YouTube Musiccast-download https://youtube.com/watch?v=... --videocast-radio <URL> [options]Start radio mode with related songscast-radio https://youtube.com/watch?v=... --count 10`cast-server [startstopstatus]`cast-play <file> [device]Cast music or video file to devicecast-play song.mp4cast-stop [device]Stop playbackcast-stopcast-status [device]Show player statuscast-statuscast-devicesList all available media playerscast-devicescast-listList downloaded filescast-listcast-helpShow helpcast-help"
      },
      {
        "title": "Your First Song",
        "body": "# Download from YouTube\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# Rename for cleaner URL (recommended)\nmv \"/tmp/youtube-music/Rick Astley - Never Gonna Give You Up.mp3\" \\\n   \"/tmp/youtube-music/never-gonna-give-you-up.mp3\"\n\n# Start the web server\ncast-server start\n\n# Cast to your default device\ncast-play never-gonna-give-you-up.mp3"
      },
      {
        "title": "Cast to Different Rooms",
        "body": "# Living room TV\ncast-play song.mp3 media_player.living_room\n\n# Kitchen speaker\ncast-play song.mp3 media_player.kitchen_speaker\n\n# Bedroom Chromecast\ncast-play song.mp3 media_player.bedroom_display\n\n# Multiple rooms at once (run multiple commands)\ncast-play song.mp3 media_player.living_room & \\\ncast-play song.mp3 media_player.bedroom_display"
      },
      {
        "title": "Check What's Playing",
        "body": "# Default device\ncast-status\n\n# Specific device\ncast-status media_player.bedroom_display\n\nOutput:\n\n📺 media_player.bedroom_display\n\nState: playing\nFriendly Name: Bedroom display\nVolume: 22%\n\nNow Playing:\n  Title: Never Gonna Give You Up\n  Artist: Rick Astley\n  Duration: 3:32\n\nApp: Default Media Receiver"
      },
      {
        "title": "Stop Playback",
        "body": "# Stop default device\ncast-stop\n\n# Stop specific device\ncast-stop media_player.living_room"
      },
      {
        "title": "See What You've Downloaded",
        "body": "# List all music files with sizes\ncast-list\n\nOutput:\n\n🎵 Downloaded Music\n\nboneheads-bank-holiday.mp3                                    9.3M\nnever-gonna-give-you-up.mp3                                 8.2M\nsong-for-nary.mp3                                          7.8M\n\nTotal: 3 files"
      },
      {
        "title": "See Available Devices",
        "body": "cast-devices\n\nOutput:\n\n📺 Available Media Players\n\nmedia_player.bedroom_display\n  Name: Bedroom display\n  State: idle\n  Supported: play_media, volume_set, volume_mute, ...\n\nmedia_player.living_room\n  Name: Living room TV\n  State: off\n  Supported: play_media, volume_set, ...\n\nDefault device: media_player.bedroom_display"
      },
      {
        "title": "📻 Radio Mode",
        "body": "Radio mode automatically discovers and downloads related songs based on YouTube recommendations. After downloading a seed song, it searches for similar tracks and adds them to your queue.\n\nStart radio mode:\n\n# Basic radio (downloads seed + 3 related songs)\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# Custom number of related songs\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ --count 10\n\n# Radio mode with video files\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ --video --count 5\n\nOr use cast-download with --radio flag:\n\n# Download with radio mode\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --radio\n\n# Download with custom count\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --radio --radio-count 5\n\n# Radio + video mode combined\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --radio --video\n\nHow it works:\n\nDownloads the seed song you specify\nExtracts artist/title from metadata\nSearches YouTube for similar videos\nDownloads related songs (prefixed with radio_)\nRelated songs are ready to cast in sequence\n\nPlay your radio queue:\n\n# Start server\ncast-server start\n\n# Play the first song\ncast-play $(ls -t /tmp/youtube-music/*.mp3 | head -n 1 | xargs basename)\n\n# Or play related songs sequentially\ncast-play radio_some-song.mp3\ncast-play radio_another-song.mp3\n# ... etc\n\nTips:\n\nRelated songs are prefixed with radio_ for easy identification\nThe radio mode searches based on the artist name from the seed song\nUse --count to control how many related songs to download\nCombine with --video flag for visual radio mode"
      },
      {
        "title": "🎬 Video Mode with Visuals",
        "body": "Video mode creates MP4 videos instead of plain MP3 files. Each video includes:\n\nThe original audio track\nAlbum art thumbnail from YouTube\nText overlay showing song title and artist\nSmooth, high-quality encoding\n\nDownload a video:\n\n# Download as MP4 with album art and text\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --video\n\n# Cast the MP4 file\ncast-server start\ncast-play \"Never Gonna Give You Up.mp4\"\n\nRadio mode with videos:\n\n# Download seed + related songs as videos\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ --video --count 5\n\n# Cast videos\ncast-play \"Never Gonna Give You Up.mp4\"\ncast-play \"radio_Together Forever.mp4\"\n# ... etc\n\nHow it works:\n\nDownloads the audio track (320K MP3 quality)\nDownloads the album art thumbnail from YouTube\nUses ffmpeg to create an MP4 video with:\n\nLooping album art background\nAudio track encoded as AAC\nText overlay (song title and artist name) at bottom\n\n\nCast the MP4 to your Chromecast (TVs with video support)\n\nVideo output:\n\nCodec: H.264 (libx264)\nAudio: AAC (192K)\nResolution: Same as thumbnail (usually 480p or 720p)\nText: White text with semi-transparent black box\nCompatible with all Chromecast devices with video support\n\nNotes:\n\nVideos take more space than MP3s (~2-3x larger)\nRequires ffmpeg to be installed on your system\nText overlay uses DejaVu Sans Bold font (included on most Linux systems)\nChromecast audio devices (like Google Home Mini) will play audio only\nChromecast with displays (TVs, Google Nest Hub) will show the full video\n\nRequirements for video mode:\n\nffmpeg must be installed on your system\n# Debian/Ubuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg"
      },
      {
        "title": "Mixed MP3 and MP4",
        "body": "cast-play automatically detects the file type:\n\n.mp3, .wav, .ogg, .m4a, .flac → music\n.mp4, .mkv, .webm, .mov → video\n\nYou can mix both formats in the same directory:\n\n# Download some as MP3\ncast-download https://youtube.com/watch?v=VIDEO_ID_1\n\n# Download some as MP4\ncast-download https://youtube.com/watch?v=VIDEO_ID_2 --video\n\n# Play both - cast-play handles the difference\ncast-play song.mp3\ncast-play video.mp4"
      },
      {
        "title": "Configuration",
        "body": "Config file: ~/.youtube-music-cast/config.sh\n\n# Home Assistant\nHA_URL=\"http://homeassistant.local:8123\"\nHA_TOKEN=\"your-long-lived-access-token-here\"\n\n# Web Server\nSERVER_IP=\"192.168.1.81\"\nSERVER_PORT=\"8735\"\n\n# Default Device (override per command)\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Directories\nDOWNLOAD_DIR=\"/tmp/youtube-music\"\nCAST_DIR=\"$HOME/.youtube-music-cast\"\n\nEdit the file directly or re-run cast-setup to update."
      },
      {
        "title": "File Naming Best Practices",
        "body": "Keep URLs clean. Simple filenames save you from headaches later."
      },
      {
        "title": "The Problem",
        "body": "❌ Bad filenames:\n\nhttp://192.168.1.81:8735/Bonehead's%20Bank%20Holiday%20(Remastered).mp3\n\nThis URL is messy, hard to type, and prone to encoding errors."
      },
      {
        "title": "The Solution",
        "body": "✅ Good filenames:\n\nhttp://192.168.1.81:8735/boneheads-bank-holiday.mp3\n\nClean, easy to type, no issues."
      },
      {
        "title": "Practical Tips",
        "body": "# After download, rename immediately\nmv \"Oasis - Bonehead's Bank Holiday (Remastered 1995).mp3\" \\\n   \"oasis-boneheads-bank-holiday.mp3\"\n\n# Use lowercase, hyphens only\nmv \"My Awesome Song.mp3\" \"my-awesome-song.mp3\"\n\n# No special characters\nmv \"song@remix#.mp3\" \"song-remix.mp3\"\n\nRule of thumb:\n\nLowercase\nHyphens instead of spaces\nNo special characters (@, #, ?, etc.)\nKeep it short"
      },
      {
        "title": "Chromecast Not in Home Assistant",
        "body": "Problem: cast-devices shows no Chromecast devices.\n\nSolution: Add Google Cast integration\n\nHome Assistant → Settings → Devices & Services\nClick \"+ Add Integration\"\nSearch \"Google Cast\" → Select it\nFollow the discovery wizard\n\nIf discovery fails:\n\nEnsure Chromecast and Home Assistant are on the same network\nTry adding manually with Chromecast IP address"
      },
      {
        "title": "Server Won't Start",
        "body": "Problem: cast-server start fails or says \"port in use\".\n\nSolution:\n\n# Check if port 8735 is in use\nnetstat -tlnp | grep 8735\n# or\nss -tlnp | grep 8735\n\n# Stop any existing server\ncast-server stop\n\n# Try starting manually to see error\ncd /tmp/youtube-music\npython3 -m http.server 8735\n\nIf port is in use by another process:\nEdit ~/.youtube-music-cast/config.sh:\n\nSERVER_PORT=\"8736\"  # Change to something else"
      },
      {
        "title": "\"File Not Found\" Error",
        "body": "Problem: cast-play song.mp3 says file not found.\n\nSolution:\n\n# List what's actually there\ncast-list\n\n# Check exact spelling (case-sensitive!)\ncast-play \"Exact-Filename.mp3\"  # Not \"exact-filename.mp3\"\n\n# Verify server is running\ncast-server status\n\nCommon mistakes:\n\nWrong case: Song.mp3 vs song.mp3\nWrong extension: song.MP3 vs song.mp3\nFile in wrong directory: Check DOWNLOAD_DIR in config"
      },
      {
        "title": "Download Fails",
        "body": "Problem: cast-download errors or hangs.\n\nSolution:\n\n# Update yt-dlp (YouTube changes often)\npip install --upgrade yt-dlp\n\n# Check version\nyt-dlp --version\n\n# Try verbose output to see what's wrong\nyt-dlp --verbose \"URL\"\n\n# Try different URL format\n# YouTube: https://youtube.com/watch?v=VIDEO_ID\n# YouTube Music: https://music.youtube.com/watch?v=VIDEO_ID\n\nIf it's a geo-blocked video:\nUse a VPN or find an alternative upload of the same track."
      },
      {
        "title": "Home Assistant Connection Error",
        "body": "Problem: curl errors when contacting HA.\n\nSolution:\n\n# Test your HA token manually\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" \\\n     -H \"Content-Type: application/json\" \\\n     \"http://homeassistant.local:8123/api/states\"\n\n# If you see JSON → token is good\n# If 401 Unauthorized → token is wrong or expired\n# If connection refused → URL is wrong or HA is down\n\nRegenerate token if needed:\nHA → Profile → Scroll down → Long-Lived Access Tokens → Generate new"
      },
      {
        "title": "Video Mode Issues",
        "body": "Problem: cast-download --video fails with \"ffmpeg not found\" or similar error.\n\nSolution:\n\n# Check if ffmpeg is installed\nffmpeg -version\n\n# If not found, install it\n# Debian/Ubuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n\nProblem: Video creation is slow or takes too long.\n\nSolution:\n\nVideo encoding is CPU-intensive. First-time creation may take 10-30 seconds per song.\nUse MP3 mode (cast-download without --video) for faster downloads.\nConsider lowering video quality in the script (edit cast-download and change -preset ultrafast to -preset fast for better quality but slower encoding).\n\nProblem: Text overlay doesn't appear or looks wrong.\n\nSolution:\n\nThe script uses DejaVu Sans Bold font. If it's not installed, text won't appear.\nInstall the font:\n# Debian/Ubuntu\nsudo apt install fonts-dejavu\n\n# macOS (usually pre-installed)\n\n\nOr edit the script to use a different font path.\n\nProblem: Chromecast audio device plays video without visuals.\n\nSolution:\n\nThis is expected behavior. Audio-only Chromecast devices (Google Home Mini, Chromecast Audio) will play the audio track from MP4 files but cannot display video.\nUse MP3 mode for audio-only devices to save bandwidth and storage.\n\nProblem: MP4 files are too large.\n\nSolution:\n\nVideos are larger than MP3s (typically 2-3x the size).\nReduce video bitrate by editing cast-download and changing -b:a 192k to -b:a 128k for audio, or adjust video codec settings.\nUse MP3 mode if storage is a concern."
      },
      {
        "title": "Radio Mode Issues",
        "body": "Problem: Radio mode downloads unrelated songs.\n\nSolution:\n\nRadio mode searches YouTube using the artist name from the seed song.\nSometimes the search may return mixed results due to ambiguous artist names.\nTry using a different seed song with a clearer artist name.\nThe radio_ prefix makes it easy to identify and remove unwanted downloads.\n\nProblem: Radio mode doesn't find any related songs.\n\nSolution:\n\nEnsure you have a stable internet connection.\nCheck that the seed song has proper metadata (title/uploader).\nTry a different seed song — some videos have limited search results.\nIncrease the count with --radio-count 10 to get more results.\n\nProblem: Related songs don't play in sequence automatically.\n\nSolution:\n\nRadio mode downloads the songs but doesn't auto-play them in sequence.\nYou need to manually play each related song, or create a simple playlist script:\n# Play all radio songs in sequence\nfor file in /tmp/youtube-music/radio_*.mp3; do\n    cast-play \"$(basename \"$file\")\"\n    sleep 5  # Wait between songs\ndone"
      },
      {
        "title": "Cast Commands Hang",
        "body": "Problem: cast-play doesn't return or music never starts.\n\nCommon causes:\n\nMedia player is offline — Check cast-devices for state\nServer isn't accessible from HA — Verify SERVER_IP in config matches current IP\nChromecast network issue — Restart Chromecast\nWrong device ID — Copy exact ID from cast-devices output\n\nQuick fix:\n\n# Restart everything\ncast-server stop\ncast-server start\ncast-play song.mp3\n\n# Check device is online\ncast-devices\n\n# Try casting from HA UI to isolate issue"
      },
      {
        "title": "Project Structure",
        "body": "youtube-music-cast/\n├── scripts/\n│   ├── cast-setup      # Configuration wizard (interactive)\n│   ├── cast-download   # Download from YouTube (uses yt-dlp)\n│   ├── cast-server     # HTTP server manager (start/stop/status)\n│   ├── cast-play       # Cast to device (HA API)\n│   ├── cast-stop       # Stop playback\n│   ├── cast-status     # Player status query\n│   ├── cast-devices    # List all HA media players\n│   ├── cast-list       # List downloaded files\n│   └── cast-help       # Help documentation\n├── install.sh          # Installation script (--global, --help)\n├── SKILL.md           # This file (ClawdHub skill definition)\n├── README.md          # User-facing documentation\n├── CHANGELOG.md       # Version history\n├── LICENSE            # MIT license\n├── .gitignore        # Protects secrets and state\n└── .clawdhub/\n    └── origin.json    # ClawdHub metadata\n\n~/.youtube-music-cast/\n└── config.sh         # Your configuration (don't commit to Git)\n\n/tmp/youtube-music/\n└── *.mp3            # Downloaded music files"
      },
      {
        "title": "yt-dlp (YouTube downloader)",
        "body": "pip install yt-dlp\n\nUpdate regularly: pip install --upgrade yt-dlp"
      },
      {
        "title": "Python 3 (HTTP server)",
        "body": "# Check version (usually pre-installed)\npython3 --version"
      },
      {
        "title": "curl (HTTP client for HA API)",
        "body": "# Check version (usually pre-installed)\ncurl --version"
      },
      {
        "title": "jq (JSON processor)",
        "body": "# Debian/Ubuntu\nsudo apt install jq\n\n# macOS\nbrew install jq"
      },
      {
        "title": "ffmpeg (Video mode - optional)",
        "body": "Required for --video flag to create MP4 videos with album art and text overlays.\n\n# Debian/Ubuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n\nCheck installation:\n\nffmpeg -version\n\nNote: Video mode is optional. If you only download MP3s, you don't need ffmpeg."
      },
      {
        "title": "1. Batch Downloads",
        "body": "Download multiple tracks or entire playlists at once:\n\n# Download playlist\nyt-dlp -x --audio-format mp3 --audio-quality 320K \\\n  -o \"/tmp/youtube-music/%(playlist_index)s-%(title)s.%(ext)s\" \\\n  \"https://youtube.com/playlist?list=PLAYLIST_ID\"\n\n# Then cast them without waiting\ncast-play 01-song.mp3\ncast-play 02-song.mp3\ncast-play 03-song.mp3"
      },
      {
        "title": "2. Keep Server Running",
        "body": "The HTTP server is lightweight (~5MB RAM). No need to stop/start between casts:\n\n# Start once\ncast-server start\n\n# Cast as many songs as you want\ncast-play song1.mp3\ncast-play song2.mp3\n# ... etc"
      },
      {
        "title": "3. Use Default Device",
        "body": "Set DEFAULT_DEVICE in config to avoid typing it every time:\n\n# In ~/.youtube-music-cast/config.sh\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Now just cast\ncast-play song.mp3  # Automatically uses bedroom_display"
      },
      {
        "title": "4. Clean Up Occasionally",
        "body": "Files in /tmp/ are cleared on reboot by design, but you can manually clean:\n\n# List all files with sizes\ncast-list\n\n# Remove old files\nrm /tmp/youtube-music/*.mp3"
      },
      {
        "title": "5. WiFi Matters",
        "body": "If streaming glitches:\n\nMove Chromecast to 5GHz WiFi\nReduce distance between Chromecast and server\nCheck for WiFi interference"
      },
      {
        "title": "6. Alias Commands",
        "body": "Add shell aliases for faster access:\n\n# Add to ~/.bashrc or ~/.zshrc\nalias cs='cast-server'\nalias cd='cast-download'\nalias cp='cast-play'\nalias cl='cast-list'\nalias cst='cast-status'\n\n# Now just type\ncs      # Start server\ncd URL   # Download\ncp song  # Cast\ncl       # List"
      },
      {
        "title": "Notes",
        "body": "Files are stored in /tmp/youtube-music/ — cleared on reboot (by design)\nWeb server runs in background, persists across sessions\nKeep filenames simple: lowercase, hyphens, no spaces/special chars\nServer and Chromecast must be on same network\nHA token is stored locally in config.sh — don't commit to Git\nQuality is 320K MP3 — good balance of quality and file size\nNo cloud services, no subscriptions, no tracking"
      },
      {
        "title": "Comparison: This vs Alternatives",
        "body": "FeatureYouTube Music CastSpotify FreeYouTube PremiumCostFreeFree (with ads)$13.99/monthAdsNoneYes, every few songsNoneOfflineYes, foreverNo (premium only)Yes, with limitQuality320K MP3160K (variable)Up to 1080p videoPrivacyLocal onlyCloud-basedCloud-basedPlatformAny ChromecastSpotify ConnectYouTube appsQueue managementManualBuilt-inBuilt-inMulti-roomManualPremium featureNo\n\nBottom line: If you value privacy, want to own your music, and don't need cloud features, this is for you."
      },
      {
        "title": "License",
        "body": "MIT License — use it, modify it, share it.\n\nVersion: 6.0.0\nAuthor: Wobo\nLicense: MIT"
      }
    ],
    "body": "YouTube Music Cast\n\nYouTube music → your Chromecast. Simple, free, works.\n\nDownload audio from YouTube or YouTube Music and stream it through Home Assistant to any Cast-enabled device. No subscriptions, no cloud services, just your local network.\n\nFeatures\n✅ Free forever — No subscriptions, no premium accounts needed\n✅ High quality — 320K MP3, crystal clear audio\n✅ Video mode — Create MP4 videos with album art and text overlays\n✅ Radio mode — Auto-discover and play related songs\n✅ Local storage — Your music stays on your machine, no cloud\n✅ Multi-room — Cast to any Chromecast device in your home\n✅ Batch download — Download entire playlists, stream anytime\n✅ Simple CLI — Fast commands, no browser required\n✅ Works offline — Once downloaded, music is yours to keep\nUse Cases\nDaily Music\n\nDownload your favorite tracks in the morning, cast them throughout the day. No waiting, no buffering.\n\nParty Mode\n\nDownload a playlist before guests arrive, then queue up songs without fumbling with phones or apps.\n\nBackground Audio\n\nPlay ambient music or podcasts while you work without worrying about ads or interruptions.\n\nMulti-Room Sync\n\nStream the same track to multiple Chromecasts simultaneously (bedroom + living room + kitchen).\n\nWhy This Over Premium Services?\nFeature\tYouTube Music Cast\tSpotify Premium\tYouTube Premium\nCost\tFree forever\t$10.99/month\t$13.99/month\nQuality\t320K MP3\tUp to 320K\tUp to 1080p video\nOffline\tYes, forever\tDownload limit\tDownload limit\nAds\tNone\tNone\tNone\nPlatforms\tAny Chromecast\tSpotify Connect devices\tYouTube apps\nPrivacy\tLocal only\tCloud-based\tCloud-based\nQuick Start\n# 1. Setup (one time, takes 2 minutes)\ncast-setup\n\n# 2. Download your first song\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# 3. Start the web server\ncast-server start\n\n# 4. Cast it to your default device\ncast-play never-gonna-give-you-up.mp3\n\n\nThat's it. Your music is playing through your Chromecast.\n\nWhat This Does\n\nThree simple steps, one command each:\n\n1. Download\n\nyt-dlp grabs audio from YouTube or YouTube Music, extracts it as MP3 (320K quality).\n\n2. Host\n\nA lightweight Python HTTP server makes your downloaded files accessible over your local network. No setup required — just Python 3.\n\n3. Cast\n\nHome Assistant's media_player.play_media service sends the HTTP URL to your Chromecast, which streams the audio.\n\nWhy a Web Server?\n\nHome Assistant's play_media service requires a URL, not a file path. The web server bridges that gap.\n\n# ✅ This works — HA can fetch via HTTP\nmedia_content_id: \"http://192.168.1.81:8735/song.mp3\"\n\n# ❌ This fails — HA can't read file paths\nmedia_content_id: \"/tmp/youtube-music/song.mp3\"\n\n\nArchitecture:\n\nYouTube URL → yt-dlp → MP3 file → Python HTTP server → Home Assistant API → Chromecast\n\nInstallation\nWhat You Need\nHome Assistant with Google Cast integration\nChromecast or Cast-enabled device (Nest speakers, Google Home, TV)\nSystem tools: yt-dlp, Python 3, curl, jq\nStep 1: Install Scripts\n# Clone or download the skill\ncd youtube-music-cast\n\n# Make all scripts executable\nchmod +x scripts/*\n\n# Install globally (recommended)\n./install.sh --global\n\n# Or install locally\n./install.sh\n\nStep 2: Run Setup Wizard\ncast-setup\n\n\nThe wizard will ask for:\n\nHome Assistant URL — e.g., http://homeassistant.local:8123\nLong-Lived Access Token — Generate in HA → Profile → Long-Lived Access Tokens\nServer IP — The machine running these scripts\nDefault media player — e.g., media_player.bedroom_display\nStep 3: Test Your Setup\n# Download a test song\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# Start the server\ncast-server start\n\n# Cast it\ncast-play song.mp3\n\n\nIf music plays, you're ready!\n\nCommands\nCommand\tDescription\tExample\ncast-setup\tRun configuration wizard\tcast-setup\ncast-download <URL> [options]\tDownload from YouTube/YouTube Music\tcast-download https://youtube.com/watch?v=... --video\ncast-radio <URL> [options]\tStart radio mode with related songs\tcast-radio https://youtube.com/watch?v=... --count 10\n`cast-server [start\tstop\tstatus]`\ncast-play <file> [device]\tCast music or video file to device\tcast-play song.mp4\ncast-stop [device]\tStop playback\tcast-stop\ncast-status [device]\tShow player status\tcast-status\ncast-devices\tList all available media players\tcast-devices\ncast-list\tList downloaded files\tcast-list\ncast-help\tShow help\tcast-help\nUsage Guide\nYour First Song\n# Download from YouTube\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# Rename for cleaner URL (recommended)\nmv \"/tmp/youtube-music/Rick Astley - Never Gonna Give You Up.mp3\" \\\n   \"/tmp/youtube-music/never-gonna-give-you-up.mp3\"\n\n# Start the web server\ncast-server start\n\n# Cast to your default device\ncast-play never-gonna-give-you-up.mp3\n\nCast to Different Rooms\n# Living room TV\ncast-play song.mp3 media_player.living_room\n\n# Kitchen speaker\ncast-play song.mp3 media_player.kitchen_speaker\n\n# Bedroom Chromecast\ncast-play song.mp3 media_player.bedroom_display\n\n# Multiple rooms at once (run multiple commands)\ncast-play song.mp3 media_player.living_room & \\\ncast-play song.mp3 media_player.bedroom_display\n\nCheck What's Playing\n# Default device\ncast-status\n\n# Specific device\ncast-status media_player.bedroom_display\n\n\nOutput:\n\n📺 media_player.bedroom_display\n\nState: playing\nFriendly Name: Bedroom display\nVolume: 22%\n\nNow Playing:\n  Title: Never Gonna Give You Up\n  Artist: Rick Astley\n  Duration: 3:32\n\nApp: Default Media Receiver\n\nStop Playback\n# Stop default device\ncast-stop\n\n# Stop specific device\ncast-stop media_player.living_room\n\nSee What You've Downloaded\n# List all music files with sizes\ncast-list\n\n\nOutput:\n\n🎵 Downloaded Music\n\nboneheads-bank-holiday.mp3                                    9.3M\nnever-gonna-give-you-up.mp3                                 8.2M\nsong-for-nary.mp3                                          7.8M\n\nTotal: 3 files\n\nSee Available Devices\ncast-devices\n\n\nOutput:\n\n📺 Available Media Players\n\nmedia_player.bedroom_display\n  Name: Bedroom display\n  State: idle\n  Supported: play_media, volume_set, volume_mute, ...\n\nmedia_player.living_room\n  Name: Living room TV\n  State: off\n  Supported: play_media, volume_set, ...\n\nDefault device: media_player.bedroom_display\n\nNew Features: Radio Mode & Video Mode\n📻 Radio Mode\n\nRadio mode automatically discovers and downloads related songs based on YouTube recommendations. After downloading a seed song, it searches for similar tracks and adds them to your queue.\n\nStart radio mode:\n\n# Basic radio (downloads seed + 3 related songs)\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ\n\n# Custom number of related songs\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ --count 10\n\n# Radio mode with video files\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ --video --count 5\n\n\nOr use cast-download with --radio flag:\n\n# Download with radio mode\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --radio\n\n# Download with custom count\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --radio --radio-count 5\n\n# Radio + video mode combined\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --radio --video\n\n\nHow it works:\n\nDownloads the seed song you specify\nExtracts artist/title from metadata\nSearches YouTube for similar videos\nDownloads related songs (prefixed with radio_)\nRelated songs are ready to cast in sequence\n\nPlay your radio queue:\n\n# Start server\ncast-server start\n\n# Play the first song\ncast-play $(ls -t /tmp/youtube-music/*.mp3 | head -n 1 | xargs basename)\n\n# Or play related songs sequentially\ncast-play radio_some-song.mp3\ncast-play radio_another-song.mp3\n# ... etc\n\n\nTips:\n\nRelated songs are prefixed with radio_ for easy identification\nThe radio mode searches based on the artist name from the seed song\nUse --count to control how many related songs to download\nCombine with --video flag for visual radio mode\n🎬 Video Mode with Visuals\n\nVideo mode creates MP4 videos instead of plain MP3 files. Each video includes:\n\nThe original audio track\nAlbum art thumbnail from YouTube\nText overlay showing song title and artist\nSmooth, high-quality encoding\n\nDownload a video:\n\n# Download as MP4 with album art and text\ncast-download https://youtube.com/watch?v=dQw4w9WgXcQ --video\n\n# Cast the MP4 file\ncast-server start\ncast-play \"Never Gonna Give You Up.mp4\"\n\n\nRadio mode with videos:\n\n# Download seed + related songs as videos\ncast-radio https://youtube.com/watch?v=dQw4w9WgXcQ --video --count 5\n\n# Cast videos\ncast-play \"Never Gonna Give You Up.mp4\"\ncast-play \"radio_Together Forever.mp4\"\n# ... etc\n\n\nHow it works:\n\nDownloads the audio track (320K MP3 quality)\nDownloads the album art thumbnail from YouTube\nUses ffmpeg to create an MP4 video with:\nLooping album art background\nAudio track encoded as AAC\nText overlay (song title and artist name) at bottom\nCast the MP4 to your Chromecast (TVs with video support)\n\nVideo output:\n\nCodec: H.264 (libx264)\nAudio: AAC (192K)\nResolution: Same as thumbnail (usually 480p or 720p)\nText: White text with semi-transparent black box\nCompatible with all Chromecast devices with video support\n\nNotes:\n\nVideos take more space than MP3s (~2-3x larger)\nRequires ffmpeg to be installed on your system\nText overlay uses DejaVu Sans Bold font (included on most Linux systems)\nChromecast audio devices (like Google Home Mini) will play audio only\nChromecast with displays (TVs, Google Nest Hub) will show the full video\n\nRequirements for video mode:\n\nffmpeg must be installed on your system\n# Debian/Ubuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n\nMixed MP3 and MP4\n\ncast-play automatically detects the file type:\n\n.mp3, .wav, .ogg, .m4a, .flac → music\n.mp4, .mkv, .webm, .mov → video\n\nYou can mix both formats in the same directory:\n\n# Download some as MP3\ncast-download https://youtube.com/watch?v=VIDEO_ID_1\n\n# Download some as MP4\ncast-download https://youtube.com/watch?v=VIDEO_ID_2 --video\n\n# Play both - cast-play handles the difference\ncast-play song.mp3\ncast-play video.mp4\n\nConfiguration\n\nConfig file: ~/.youtube-music-cast/config.sh\n\n# Home Assistant\nHA_URL=\"http://homeassistant.local:8123\"\nHA_TOKEN=\"your-long-lived-access-token-here\"\n\n# Web Server\nSERVER_IP=\"192.168.1.81\"\nSERVER_PORT=\"8735\"\n\n# Default Device (override per command)\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Directories\nDOWNLOAD_DIR=\"/tmp/youtube-music\"\nCAST_DIR=\"$HOME/.youtube-music-cast\"\n\n\nEdit the file directly or re-run cast-setup to update.\n\nFile Naming Best Practices\n\nKeep URLs clean. Simple filenames save you from headaches later.\n\nThe Problem\n\n❌ Bad filenames:\n\nhttp://192.168.1.81:8735/Bonehead's%20Bank%20Holiday%20(Remastered).mp3\n\n\nThis URL is messy, hard to type, and prone to encoding errors.\n\nThe Solution\n\n✅ Good filenames:\n\nhttp://192.168.1.81:8735/boneheads-bank-holiday.mp3\n\n\nClean, easy to type, no issues.\n\nPractical Tips\n# After download, rename immediately\nmv \"Oasis - Bonehead's Bank Holiday (Remastered 1995).mp3\" \\\n   \"oasis-boneheads-bank-holiday.mp3\"\n\n# Use lowercase, hyphens only\nmv \"My Awesome Song.mp3\" \"my-awesome-song.mp3\"\n\n# No special characters\nmv \"song@remix#.mp3\" \"song-remix.mp3\"\n\n\nRule of thumb:\n\nLowercase\nHyphens instead of spaces\nNo special characters (@, #, ?, etc.)\nKeep it short\nTroubleshooting\nChromecast Not in Home Assistant\n\nProblem: cast-devices shows no Chromecast devices.\n\nSolution: Add Google Cast integration\n\nHome Assistant → Settings → Devices & Services\nClick \"+ Add Integration\"\nSearch \"Google Cast\" → Select it\nFollow the discovery wizard\n\nIf discovery fails:\n\nEnsure Chromecast and Home Assistant are on the same network\nTry adding manually with Chromecast IP address\nServer Won't Start\n\nProblem: cast-server start fails or says \"port in use\".\n\nSolution:\n\n# Check if port 8735 is in use\nnetstat -tlnp | grep 8735\n# or\nss -tlnp | grep 8735\n\n# Stop any existing server\ncast-server stop\n\n# Try starting manually to see error\ncd /tmp/youtube-music\npython3 -m http.server 8735\n\n\nIf port is in use by another process: Edit ~/.youtube-music-cast/config.sh:\n\nSERVER_PORT=\"8736\"  # Change to something else\n\n\"File Not Found\" Error\n\nProblem: cast-play song.mp3 says file not found.\n\nSolution:\n\n# List what's actually there\ncast-list\n\n# Check exact spelling (case-sensitive!)\ncast-play \"Exact-Filename.mp3\"  # Not \"exact-filename.mp3\"\n\n# Verify server is running\ncast-server status\n\n\nCommon mistakes:\n\nWrong case: Song.mp3 vs song.mp3\nWrong extension: song.MP3 vs song.mp3\nFile in wrong directory: Check DOWNLOAD_DIR in config\nDownload Fails\n\nProblem: cast-download errors or hangs.\n\nSolution:\n\n# Update yt-dlp (YouTube changes often)\npip install --upgrade yt-dlp\n\n# Check version\nyt-dlp --version\n\n# Try verbose output to see what's wrong\nyt-dlp --verbose \"URL\"\n\n# Try different URL format\n# YouTube: https://youtube.com/watch?v=VIDEO_ID\n# YouTube Music: https://music.youtube.com/watch?v=VIDEO_ID\n\n\nIf it's a geo-blocked video: Use a VPN or find an alternative upload of the same track.\n\nHome Assistant Connection Error\n\nProblem: curl errors when contacting HA.\n\nSolution:\n\n# Test your HA token manually\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" \\\n     -H \"Content-Type: application/json\" \\\n     \"http://homeassistant.local:8123/api/states\"\n\n# If you see JSON → token is good\n# If 401 Unauthorized → token is wrong or expired\n# If connection refused → URL is wrong or HA is down\n\n\nRegenerate token if needed: HA → Profile → Scroll down → Long-Lived Access Tokens → Generate new\n\nVideo Mode Issues\n\nProblem: cast-download --video fails with \"ffmpeg not found\" or similar error.\n\nSolution:\n\n# Check if ffmpeg is installed\nffmpeg -version\n\n# If not found, install it\n# Debian/Ubuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n\n\nProblem: Video creation is slow or takes too long.\n\nSolution:\n\nVideo encoding is CPU-intensive. First-time creation may take 10-30 seconds per song.\nUse MP3 mode (cast-download without --video) for faster downloads.\nConsider lowering video quality in the script (edit cast-download and change -preset ultrafast to -preset fast for better quality but slower encoding).\n\nProblem: Text overlay doesn't appear or looks wrong.\n\nSolution:\n\nThe script uses DejaVu Sans Bold font. If it's not installed, text won't appear.\nInstall the font:\n# Debian/Ubuntu\nsudo apt install fonts-dejavu\n\n# macOS (usually pre-installed)\n\nOr edit the script to use a different font path.\n\nProblem: Chromecast audio device plays video without visuals.\n\nSolution:\n\nThis is expected behavior. Audio-only Chromecast devices (Google Home Mini, Chromecast Audio) will play the audio track from MP4 files but cannot display video.\nUse MP3 mode for audio-only devices to save bandwidth and storage.\n\nProblem: MP4 files are too large.\n\nSolution:\n\nVideos are larger than MP3s (typically 2-3x the size).\nReduce video bitrate by editing cast-download and changing -b:a 192k to -b:a 128k for audio, or adjust video codec settings.\nUse MP3 mode if storage is a concern.\nRadio Mode Issues\n\nProblem: Radio mode downloads unrelated songs.\n\nSolution:\n\nRadio mode searches YouTube using the artist name from the seed song.\nSometimes the search may return mixed results due to ambiguous artist names.\nTry using a different seed song with a clearer artist name.\nThe radio_ prefix makes it easy to identify and remove unwanted downloads.\n\nProblem: Radio mode doesn't find any related songs.\n\nSolution:\n\nEnsure you have a stable internet connection.\nCheck that the seed song has proper metadata (title/uploader).\nTry a different seed song — some videos have limited search results.\nIncrease the count with --radio-count 10 to get more results.\n\nProblem: Related songs don't play in sequence automatically.\n\nSolution:\n\nRadio mode downloads the songs but doesn't auto-play them in sequence.\nYou need to manually play each related song, or create a simple playlist script:\n# Play all radio songs in sequence\nfor file in /tmp/youtube-music/radio_*.mp3; do\n    cast-play \"$(basename \"$file\")\"\n    sleep 5  # Wait between songs\ndone\n\nCast Commands Hang\n\nProblem: cast-play doesn't return or music never starts.\n\nCommon causes:\n\nMedia player is offline — Check cast-devices for state\nServer isn't accessible from HA — Verify SERVER_IP in config matches current IP\nChromecast network issue — Restart Chromecast\nWrong device ID — Copy exact ID from cast-devices output\n\nQuick fix:\n\n# Restart everything\ncast-server stop\ncast-server start\ncast-play song.mp3\n\n# Check device is online\ncast-devices\n\n# Try casting from HA UI to isolate issue\n\nProject Structure\nyoutube-music-cast/\n├── scripts/\n│   ├── cast-setup      # Configuration wizard (interactive)\n│   ├── cast-download   # Download from YouTube (uses yt-dlp)\n│   ├── cast-server     # HTTP server manager (start/stop/status)\n│   ├── cast-play       # Cast to device (HA API)\n│   ├── cast-stop       # Stop playback\n│   ├── cast-status     # Player status query\n│   ├── cast-devices    # List all HA media players\n│   ├── cast-list       # List downloaded files\n│   └── cast-help       # Help documentation\n├── install.sh          # Installation script (--global, --help)\n├── SKILL.md           # This file (ClawdHub skill definition)\n├── README.md          # User-facing documentation\n├── CHANGELOG.md       # Version history\n├── LICENSE            # MIT license\n├── .gitignore        # Protects secrets and state\n└── .clawdhub/\n    └── origin.json    # ClawdHub metadata\n\n~/.youtube-music-cast/\n└── config.sh         # Your configuration (don't commit to Git)\n\n/tmp/youtube-music/\n└── *.mp3            # Downloaded music files\n\nRequirements\nyt-dlp (YouTube downloader)\npip install yt-dlp\n\n\nUpdate regularly: pip install --upgrade yt-dlp\n\nPython 3 (HTTP server)\n# Check version (usually pre-installed)\npython3 --version\n\ncurl (HTTP client for HA API)\n# Check version (usually pre-installed)\ncurl --version\n\njq (JSON processor)\n# Debian/Ubuntu\nsudo apt install jq\n\n# macOS\nbrew install jq\n\nffmpeg (Video mode - optional)\n\nRequired for --video flag to create MP4 videos with album art and text overlays.\n\n# Debian/Ubuntu\nsudo apt install ffmpeg\n\n# macOS\nbrew install ffmpeg\n\n\nCheck installation:\n\nffmpeg -version\n\n\nNote: Video mode is optional. If you only download MP3s, you don't need ffmpeg.\n\nPerformance Tips\n1. Batch Downloads\n\nDownload multiple tracks or entire playlists at once:\n\n# Download playlist\nyt-dlp -x --audio-format mp3 --audio-quality 320K \\\n  -o \"/tmp/youtube-music/%(playlist_index)s-%(title)s.%(ext)s\" \\\n  \"https://youtube.com/playlist?list=PLAYLIST_ID\"\n\n# Then cast them without waiting\ncast-play 01-song.mp3\ncast-play 02-song.mp3\ncast-play 03-song.mp3\n\n2. Keep Server Running\n\nThe HTTP server is lightweight (~5MB RAM). No need to stop/start between casts:\n\n# Start once\ncast-server start\n\n# Cast as many songs as you want\ncast-play song1.mp3\ncast-play song2.mp3\n# ... etc\n\n3. Use Default Device\n\nSet DEFAULT_DEVICE in config to avoid typing it every time:\n\n# In ~/.youtube-music-cast/config.sh\nDEFAULT_DEVICE=\"media_player.bedroom_display\"\n\n# Now just cast\ncast-play song.mp3  # Automatically uses bedroom_display\n\n4. Clean Up Occasionally\n\nFiles in /tmp/ are cleared on reboot by design, but you can manually clean:\n\n# List all files with sizes\ncast-list\n\n# Remove old files\nrm /tmp/youtube-music/*.mp3\n\n5. WiFi Matters\n\nIf streaming glitches:\n\nMove Chromecast to 5GHz WiFi\nReduce distance between Chromecast and server\nCheck for WiFi interference\n6. Alias Commands\n\nAdd shell aliases for faster access:\n\n# Add to ~/.bashrc or ~/.zshrc\nalias cs='cast-server'\nalias cd='cast-download'\nalias cp='cast-play'\nalias cl='cast-list'\nalias cst='cast-status'\n\n# Now just type\ncs      # Start server\ncd URL   # Download\ncp song  # Cast\ncl       # List\n\nNotes\nFiles are stored in /tmp/youtube-music/ — cleared on reboot (by design)\nWeb server runs in background, persists across sessions\nKeep filenames simple: lowercase, hyphens, no spaces/special chars\nServer and Chromecast must be on same network\nHA token is stored locally in config.sh — don't commit to Git\nQuality is 320K MP3 — good balance of quality and file size\nNo cloud services, no subscriptions, no tracking\nComparison: This vs Alternatives\nFeature\tYouTube Music Cast\tSpotify Free\tYouTube Premium\nCost\tFree\tFree (with ads)\t$13.99/month\nAds\tNone\tYes, every few songs\tNone\nOffline\tYes, forever\tNo (premium only)\tYes, with limit\nQuality\t320K MP3\t160K (variable)\tUp to 1080p video\nPrivacy\tLocal only\tCloud-based\tCloud-based\nPlatform\tAny Chromecast\tSpotify Connect\tYouTube apps\nQueue management\tManual\tBuilt-in\tBuilt-in\nMulti-room\tManual\tPremium feature\tNo\n\nBottom line: If you value privacy, want to own your music, and don't need cloud features, this is for you.\n\nLicense\n\nMIT License — use it, modify it, share it.\n\nVersion: 6.0.0 Author: Wobo License: MIT"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/AidanTheBandit/ytm-cast",
    "publisherUrl": "https://clawhub.ai/AidanTheBandit/ytm-cast",
    "owner": "AidanTheBandit",
    "version": "6.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/ytm-cast",
    "downloadUrl": "https://openagent3.xyz/downloads/ytm-cast",
    "agentUrl": "https://openagent3.xyz/skills/ytm-cast/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ytm-cast/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ytm-cast/agent.md"
  }
}