Every size YouTube keeps
When a video is uploaded, YouTube generates a set of cover images at fixed sizes and serves them from i.ytimg.com. The ones that matter:
| Name | Size | Exists for |
|---|---|---|
| maxresdefault | 1280 × 720 | Videos uploaded in 720p or better |
| sddefault | 640 × 480 | Most videos |
| hqdefault | 480 × 360 | Every video |
| mqdefault | 320 × 180 | Every video |
Only hqdefault and smaller are guaranteed. The downloader asks for the largest first and steps down until YouTube answers with a real image, so you always get the best one available without guessing names.
When the uploader set a custom thumbnail, that is the image you get: the one they designed, not a random frame from the video.
Why a file and not a screenshot
A screenshot of the YouTube page gives you the thumbnail at whatever size your screen showed it, with compression artefacts from the page on top. The file from i.ytimg.com is the original YouTube serves to every player – sharp enough to use in a presentation, a playlist cover or a blog post about the video.
In Telegram, the image is sent as a document rather than a photo for the same reason: Telegram shrinks and recompresses photos, and a document is left untouched.
Part of the YouTube menu
In the bot, the thumbnail is one of the buttons under every YouTube link, alongside the video qualities, audio and find the song. For album covers of songs rather than video thumbnails, the album art downloader finds the official artwork in up to 3000 × 3000.