This post will help you if you want to get the preview image for a YouTube video. You may want to you this if you want to trigger the video to launch in a pop up window, or you want to link to the video.
I'm not sure how far back it goes, but it works for PSY's Gangnam Style which is from July 2012 and Justin Beiber's Baby which is from February 2010.
You need the id of the video which is in the url after v=
https://www.youtube.com/watch?v=cIboJm2WzKY
When you have the video id, you can use it in this url to get the image.
URL:
https://i.ytimg.com/vi/<strong>{0}</strong>/maxresdefault.jpg
@{
string youTubeId = "cIboJm2WzKY";
const string YOUTUBE_PREVIEW_IMAGE_URL = "https://i.ytimg.com/vi/{0}/maxresdefault.jpg";
}
<img src="@String.Format(YOUTUBE_PREVIEW_IMAGE_URL, youTubeId)" />
//The output will be
<img src="https://i.ytimg.com/vi/cIboJm2WzKY/maxresdefault.jpg">
I trust this has been pretty straight forward for you to follow. If you have any questions, feel free to write them in the comments. Don't forget to share this post with your friends and colleagues.