From 2b7804b22a4738c772aef928a20a091d94fee138 Mon Sep 17 00:00:00 2001 From: EEKIM10 Date: Tue, 14 Mar 2023 20:37:18 +0000 Subject: [PATCH] Fix yt-dlp --- cogs/other.py | 11 ++++++++--- domains.txt | 9 +++++++++ web/server.py | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cogs/other.py b/cogs/other.py index d096741..37d3241 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -750,7 +750,7 @@ class OtherCog(commands.Cog): options = [ "--no-colors", "--no-playlist", - "--max-filesize", str(MAX_SIZE) + "M", + # "--max-filesize", str(MAX_SIZE) + "M", "--no-warnings", "--output", OUTPUT_FILE, ] @@ -795,9 +795,14 @@ class OtherCog(commands.Cog): stderr_log_file ] if upload_log else [] for file_name in Path(tempdir).glob(f"{ctx.user.id}.*"): + stat = file_name.stat() + size_mb = stat.st_size / 1024 ** 2 + if size_mb > MAX_SIZE - 0.1: + _x = io.BytesIO(f"File {file_name.name} was too large ({size_mb:,.1f}MB vs {MAX_SIZE:.1f}MB)".encode()) + files.append(discord.File(_x, filename=file_name.name + ".txt")) try: - async with aiofiles.open(file_name) as file: - video = discord.File(await file.read(), filename=file_name.name) + with open(file_name) as file: + video = discord.File(file, filename=file_name.name) files.append(video) except FileNotFoundError: continue diff --git a/domains.txt b/domains.txt index ef674c0..e3cd49d 100644 --- a/domains.txt +++ b/domains.txt @@ -28014,3 +28014,12 @@ kekma.net dogehls.xyz nhentai.com fast.com +cup.shronkservz.tk +.+.archive.org +(.+\.)*reddit.com +.+\.shronkservz.tk +.+.github.io +.+.ca +cakefarts.org +newscatinbrazil.com +tubgirl.ca diff --git a/web/server.py b/web/server.py index 5670f17..bab15de 100644 --- a/web/server.py +++ b/web/server.py @@ -18,7 +18,7 @@ GENERAL = "https://ptb.discord.com/channels/994710566612500550/10189153423172772 OAUTH_ENABLED = OAUTH_ID and OAUTH_SECRET and OAUTH_REDIRECT_URI -app = FastAPI() +app = FastAPI(root_path="/jimmy") app.state.bot = None app.state.states = set() app.state.http = httpx.Client()