From 1cf5c140d69e852e25f0a921ab9e86a92965be34 Mon Sep 17 00:00:00 2001 From: nex Date: Thu, 25 May 2023 14:24:39 +0100 Subject: [PATCH] Pull cookies from firefox --- cogs/other.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cogs/other.py b/cogs/other.py index 83c07ff..7a5f3c1 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -866,10 +866,15 @@ class OtherCog(commands.Cog): ) = "", extract_audio: bool = False, upload_log: bool = False, - compress_if_possible: bool = False + # cookies: discord.Option( + # bool, + # description="Whether to ask for cookies.", + # default=False + # ) = False ): """Downloads a video using youtube-dl""" await ctx.defer() + compress_if_possible = False formats = await self.list_formats(url) if list_formats: embeds = [] @@ -995,6 +1000,13 @@ class OtherCog(commands.Cog): ] args["format"] = args["format"] or f"(ba/b)[filesize<={MAX_SIZE_MB}M]" + try: + url = urlparse(url) + if url.netloc in ("www.instagram.com", "instagram.com"): + args["cookiesfrombrowser"] = ("firefox", "default") + except ValueError: + pass + if args["format"] is None: args["format"] = f"(bv*+ba/bv/ba/b)[filesize<={MAX_SIZE_MB}M]" with yt_dlp.YoutubeDL(args) as downloader: