You need the id of the video which is in the url after v=
https://www.youtube.com/watch?v=9bZkp7q19f0
https://www.youtube.com/watch?v=9bZkp7q19f0
When you have the video id, you can use it in this url to get the image.
URL:
URL:
https://i.ytimg.com/vi/{0}/maxresdefault.jpg
@{ string gangnamStyleYouTubeId = "9bZkp7q19f0"; const string YOUTUBE_PREVIEW_IMAGE_URL = "https://i.ytimg.com/vi/{0}/maxresdefault.jpg"; } <img src="@String.Format(YOUTUBE_PREVIEW_IMAGE_URL, gangnamStyleYouTubeId)" />
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.
No comments:
Post a Comment