From 5b8c433e9516ab2123263b24550a3acab8d73431 Mon Sep 17 00:00:00 2001 From: phixxy Date: Wed, 4 Sep 2024 20:35:52 -0700 Subject: [PATCH] fixed filename output to not be a url --- cogs/ytdl.py | 4 +++- data/ytdl/youtubedl.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cogs/ytdl.py b/cogs/ytdl.py index e438c2d..a48f430 100644 --- a/cogs/ytdl.py +++ b/cogs/ytdl.py @@ -26,7 +26,9 @@ class YoutubeDL(BotBaseCog): async def check_for_downloads(self): for file in os.listdir("data/ytdl"): if file.endswith(".txt"): - await self.bot.get_channel(544408659174883328).send(f"{file[:-4]}") + with open(f"data/ytdl/{file}", "r") as f: + url = f.read() + await self.bot.get_channel(544408659174883328).send(f"{url}") os.remove(f"data/ytdl/{file}") async def setup(bot): diff --git a/data/ytdl/youtubedl.py b/data/ytdl/youtubedl.py index 33ed4bf..dae3e58 100644 --- a/data/ytdl/youtubedl.py +++ b/data/ytdl/youtubedl.py @@ -45,7 +45,7 @@ def main(): zip_file = zip_all_files() output_url = upload_to_litterbox(zip_file) print(output_url) - with open(f"data/ytdl/{output_url}.txt", "w") as output_file: + with open(f"data/ytdl/{time.time()}.txt", "w") as output_file: output_file.write(output_url) output_file.close() else: