Ask HN: Why does YouTube have 200kB of JavaScript before the title tag?
I maintain a bot that listens for URLs in a chat, fetches the first kB of the page to extract their <title> and post it in the chat.
A few years ago, it stopped working on Youtube. I increased the limit to 32kB, as I figured it would give a safe margin.
Well, it broke again some time this month:
>>> import urllib.request
>>> urllib.request.urlopen('https://www.youtube.com/watch?v=dQw4w9WgXcQ').read().index(b'<title')
192194
This seems to be mostly inlined minified Javascript. Why does Youtube do this instead of including scripts that could be cached?