Sometimes there are simple solutions to life’s little problems. I had a need to get the thumbnail image associated with a YouTube video. I spent ages mucking around in the browser code inspector trying to work out how I could achieve this without much success.
Turns out that there is a simple, repeatable way using YouTube’s built-in thumbnail URLs
Get the Video ID
Every YouTube video has a predictable thumbnail URL, for example: https://www.youtube.com/watch?v=dQw4w9WgXcQ. Go on, click it, you know you want to!
So generically this is:
https://www.youtube.com/watch?v=VIDEO_ID
And in our example above the ID is dQw4w9WgXcQ.
Get Images at Different Resolutions
To get the thumbnail images just replace “VIDEO_ID” in the following examples with the actual ID:
Highest-resolution (if available)
https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpg
Standard-resolution
https://img.youtube.com/vi/VIDEO_ID/hqdefault.jpg
Other sizes
https://img.youtube.com/vi/VIDEO_ID/mqdefault.jpg (medium)
https://img.youtube.com/vi/VIDEO_ID/sddefault.jpg (standard def)
https://img.youtube.com/vi/VIDEO_ID/default.jpg (small)
Just paste any of those into your browser → right-click → Save Image As…
It’s as simple as that!