From e4cf248afd3f21350bb7c64abefcfa4995fcff88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 10 Sep 2023 13:22:05 +0300 Subject: [PATCH] Up the page download limit for youtube compatibility --- botcmd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/botcmd.py b/botcmd.py index 5471582..5eae4f9 100644 --- a/botcmd.py +++ b/botcmd.py @@ -149,7 +149,9 @@ def handle_message(*, prefix, message, nick, channel, irc): if response.info().get_content_type() == 'text/html': # First 4KiB of a page should be enough for any # Turns out it's not, so download 64KiB - page_source_fragment = response.read(64 * 1024) + # As of 2023-09-10, youtube requires up to 320KiB (!), + # so download first 512KiB + page_source_fragment = response.read(512 * 1024) title = sanitize(extract_title(page_source_fragment)) if title is not None: