When right-clicking on a YouTube video, open "Stats for nerds". You can see a column "Connection Speed" which, to my surprise, is usually correct. But how does it know?
A normal speedtest will of course show the maximum bandwidth, but YouTube is not doing that. "Network Activity" shows how much YouTube is really using (I confirmed that by another speed meter).
p.s., Youtube is not stress testing periodically; the "Connection Speed" updates in normal video playing.
The "Connection Speed" value is also correct on various pings. I tried VPN all over the world, from 10 ms to 400+ ms.