soundcloid now half-works

This commit is contained in:
Bence T. 2025-04-30 21:29:41 +02:00
parent 740f62cafa
commit 6d69421305

15
main.py
View file

@ -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: