Up the page download limit for youtube compatibility

This commit is contained in:
Juhani Krekelä 2023-09-10 13:22:05 +03:00
parent c2696592b1
commit e4cf248afd
1 changed files with 3 additions and 1 deletions

View File

@ -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 <title>
# 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: