From 6d69421305eb6ef79f2334506cdd5d9deb22d029 Mon Sep 17 00:00:00 2001 From: "Bence T." <3326575+tbb98@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:29:41 +0200 Subject: [PATCH] soundcloid now half-works --- main.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 3c73614..ae5749e 100644 --- a/main.py +++ b/main.py @@ -45,27 +45,30 @@ async def play(ctx, url: str): blocked_keywords = [line.strip().lower() for line in f if line.strip()] ydl_opts = { - "format": "bestaudio", + "format": "bestaudio/best", "quiet": True, - "default_search": "ytsearch" + "noplaylist": True, + "default_search": "auto", } with yt_dlp.YoutubeDL(ydl_opts) as ydl: info = ydl.extract_info(url, download=False) title = info["title"].lower() - if any(keyword in title for keyword in blocked_keywords): await ctx.send(f"na ezt a fost nem jatszom le: `{info['title']}`") return - audio_url = info["url"] + print("Audio URL:", audio_url) ffmpeg_options = { - "before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", + "before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -protocol_whitelist file,http,https,tcp,tls,crypto", "options": "-vn" } - voice_client.play(FFmpegPCMAudio(audio_url, **ffmpeg_options), after=lambda e: print(f"Finished playing: {e}")) + voice_client.play( + FFmpegPCMAudio(audio_url, **ffmpeg_options), + after=lambda e: print(f"Finished playing: {e}") + ) await ctx.send(f"most ez a fos szól: {info['title']}") except Exception as e: