diff --git a/downloader.py b/downloader.py index 72a94bb..eb41af7 100644 --- a/downloader.py +++ b/downloader.py @@ -92,11 +92,27 @@ def download_mp3(url, quality='320'): # Prefer yt-dlp for YouTube because it can actually control MP3 output bitrate. if _can_use_ytdlp(): try: - print(f"⬇️ Downloading via yt-dlp @ {quality_kbps}kbps...") + print(f"✨ Using yt-dlp (preferred method)") + print(f"⬇️ Downloading @ {quality_kbps}kbps...") return _download_with_ytdlp(url, quality_kbps) except Exception as e: # If yt-dlp fails for any reason, fall back to the existing Cobalt flow. - print(f"⚠️ yt-dlp failed, falling back to Cobalt: {e}") + print(f"⚠️ yt-dlp failed, falling back to Cobalt API: {e}") + else: + # Check what's missing + has_ffmpeg = shutil.which("ffmpeg") is not None + has_ytdlp = False + try: + import yt_dlp # noqa: F401 + has_ytdlp = True + except: + pass + + if not has_ffmpeg: + print("⚠️ ffmpeg not found - using Cobalt API fallback") + if not has_ytdlp: + print("⚠️ yt-dlp not installed - using Cobalt API fallback") + print(" 💡 Install with: pip install yt-dlp") try: # Use Cobalt v9 API to download