How to Get a YouTube Video Screenshot Image (Thumbnail) URL using JavaScript

Basically you just have to take the v=ladlfasd parameter and put it in this url:

Where it is 2.jpg for small, 0.jpg for large

The javascript function:

You can pass a YouTube video URL or video id and the function will return a path to the video image. The second function argument is optional. You can specify the size of returned image. It can be big (320×240) or small (128×96), defaults to big.

Here is an example usage:

Leave a Reply

Your email address will not be published. Required fields are marked *