Fix cookies.txt

This commit is contained in:
nexy7574 2023-10-30 18:40:44 +00:00
parent b109e93cb2
commit 237c56514a
2 changed files with 10 additions and 11 deletions

View file

@ -40,7 +40,7 @@ def overlay_logo(img: PIL.Image.Image) -> PIL.Image.Image:
logo.load()
logo = logo.resize((1024, 1024))
img = img.resize((1024, 1024))
img = _overlay_images(img, logo, blend_modes.lighten_only, 1)
return img

View file

@ -875,15 +875,6 @@ class OtherCog(commands.Cog):
):
"""Downloads a video using youtube-dl"""
cookies = io.StringIO()
if cookies_txt is None:
p = (Path(__file__).parent.parent / "cookies.txt")
if p.exists():
with p.open("r") as f:
cookies.write(f.read())
else:
cookies.write("# No cookies.txt file found.")
else:
cookies.write(await cookies_txt.read())
cookies.seek(0)
await ctx.defer()
@ -907,6 +898,14 @@ class OtherCog(commands.Cog):
stdout = tempdir / "stdout.txt"
stderr = tempdir / "stderr.txt"
default_cookies_txt = (Path.cwd() / "jimmy-cookies.txt")
real_cookies_txt = tempdir / "cookies.txt"
if cookies_txt is not None:
await cookies_txt.save(fp=real_cookies_txt)
else:
default_cookies_txt.touch()
shutil.copy(default_cookies_txt, real_cookies_txt)
class Logger:
def __init__(self):
self.stdout = open(stdout, "w+")
@ -966,7 +965,7 @@ class OtherCog(commands.Cog):
],
"merge_output_format": "webm/mp4/mov/flv/avi/ogg/m4a/wav/mp3/opus/mka/mkv",
"source_address": "0.0.0.0",
"cookiesfile": cookies
"cookiesfile": real_cookies_txt
}
if extract_audio:
args["postprocessors"] = [