Pull cookies from firefox

This commit is contained in:
Nexus 2023-05-25 14:24:39 +01:00
parent 97bb88fd5c
commit 1cf5c140d6
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

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