blocklist is in a file
This commit is contained in:
parent
e4a9b3ddbb
commit
34e0b1e9d1
2 changed files with 27 additions and 10 deletions
16
main.py
16
main.py
|
|
@ -39,25 +39,21 @@ async def play(ctx, url: str):
|
|||
voice_client.stop()
|
||||
|
||||
|
||||
# Stream audio from YouTube
|
||||
try:
|
||||
# yt-dlp options
|
||||
# Load blocked keywords from file
|
||||
with open("blocked_keywords.txt", "r", encoding="utf-8") as f:
|
||||
blocked_keywords = [line.strip().lower() for line in f if line.strip()]
|
||||
|
||||
ydl_opts = {
|
||||
"format": "bestaudio", # Prefer Opus with at least 160 kbps
|
||||
"format": "bestaudio",
|
||||
"quiet": True,
|
||||
"default_search": "ytsearch", # <--- This is the key fix
|
||||
"default_search": "ytsearch"
|
||||
}
|
||||
|
||||
|
||||
|
||||
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||
info = ydl.extract_info(url, download=False)
|
||||
title = info["title"].lower()
|
||||
|
||||
blocked_keywords = [
|
||||
"roma", "cigány", "mulatós", "azahriah", "azariah", "majka", "gypsy", "zgstudio", "curtis", "gipsy", "karpatia", "kárpátia",
|
||||
"tóth gabi", "jolly", "dögös robi", "sandu ciorba", "maco mamuko", "ismerős arcok", "nicolae guta", "egészséges fejbőr", "puzsér"
|
||||
]
|
||||
if any(keyword in title for keyword in blocked_keywords):
|
||||
await ctx.send(f"na ezt a fost nem jatszom le: `{info['title']}`")
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue