mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
Fix cookies.txt
This commit is contained in:
parent
b109e93cb2
commit
237c56514a
2 changed files with 10 additions and 11 deletions
|
@ -875,15 +875,6 @@ class OtherCog(commands.Cog):
|
||||||
):
|
):
|
||||||
"""Downloads a video using youtube-dl"""
|
"""Downloads a video using youtube-dl"""
|
||||||
cookies = io.StringIO()
|
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)
|
cookies.seek(0)
|
||||||
|
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
|
@ -907,6 +898,14 @@ class OtherCog(commands.Cog):
|
||||||
stdout = tempdir / "stdout.txt"
|
stdout = tempdir / "stdout.txt"
|
||||||
stderr = tempdir / "stderr.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:
|
class Logger:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.stdout = open(stdout, "w+")
|
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",
|
"merge_output_format": "webm/mp4/mov/flv/avi/ogg/m4a/wav/mp3/opus/mka/mkv",
|
||||||
"source_address": "0.0.0.0",
|
"source_address": "0.0.0.0",
|
||||||
"cookiesfile": cookies
|
"cookiesfile": real_cookies_txt
|
||||||
}
|
}
|
||||||
if extract_audio:
|
if extract_audio:
|
||||||
args["postprocessors"] = [
|
args["postprocessors"] = [
|
||||||
|
|
Loading…
Reference in a new issue