Batch download

This commit is contained in:
2024-11-10 19:08:59 +01:00
parent 489dd9feb6
commit c225a3e252
2 changed files with 12 additions and 4 deletions
+10 -3
View File
@@ -611,9 +611,16 @@ class MusicModule(commands.Cog):
text = file_bytes.decode(encoding=check.group(1))
self.logger.info(text)
lines = text.split("\n")
for item in lines:
self.logger.info(item)
for link in lines:
pat = r"^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$"
if re.match(pat, link) and (re.match(".*youtube.*", link) or re.match(".*youtu.be.*", link)):
self.logger.info("%s to link do jutuba", link)
elif re.match(pat, link) and re.match(".*spotify.*", link):
self.logger.info("%s to link do spotify", link)
elif re.match(pat, link):
self.logger.info("%s to link do czegos", link)
else:
ctx.reply("Spierdalaj")
else:
ctx.reply("Spierdalaj")