From 4f4906545d897c102088481737b3210a2fe96cd9 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 11 Feb 2019 01:20:52 +0100 Subject: [PATCH] =?UTF-8?q?Centuplicata=20la=20velocit=C3=A0=20di=20downlo?= =?UTF-8?q?ad=20delle=20playlist.=20Seriamente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- discordbot.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/discordbot.py b/discordbot.py index d4683a9f..f4da08cf 100644 --- a/discordbot.py +++ b/discordbot.py @@ -855,7 +855,9 @@ class RoyalDiscordBot(discord.Client): async with self.main_channel.typing(): with youtube_dl.YoutubeDL({"quiet": True, "ignoreerrors": True, - "simulate": True}) as ytdl: + "simulate": True, + "extract_flat": True, + "force_noplaylist": True}) as ytdl: info = await loop.run_in_executor(executor, functools.partial(ytdl.extract_info, url=url, download=False)) if info is None: @@ -866,7 +868,10 @@ class RoyalDiscordBot(discord.Client): if "entries" in info: logger.debug(f"Playlist detected at {url}.") for entry in info["entries"]: - self.video_queue.add(YoutubeDLVideo(entry["webpage_url"], enqueuer=enqueuer), index) + if entry["ie_key"] == "Youtube": + self.video_queue.add(YoutubeDLVideo(f"https://youtu.be/{entry['id']}", enqueuer=enqueuer), index) + else: + self.video_queue.add(YoutubeDLVideo(entry["webpage_url"], enqueuer=enqueuer), index) return logger.debug(f"Single video detected at {url}.") self.video_queue.add(YoutubeDLVideo(url, enqueuer=enqueuer), index) @@ -1225,7 +1230,7 @@ class RoyalDiscordBot(discord.Client): ] await self.add_video_from_url(random.sample(videos, 1)[0], enqueuer=author) await channel.send(f"⚔️💀🤝") - logger.debug(f"Added random emojis? to the queue (EE2).") + logger.debug(f"Added randomkda to the queue (EE2).") def process(users_connection=None):