2015年5月25日 星期一

[HTML]如何截取 Youtube 影片預設圖

Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg (480*360)
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg (120*90 影片開頭的小截圖)
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg (120*90 是 0.jpg 的縮小圖)
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg (120*90 影片結尾的小截圖)

The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg2.jpg3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg (120*90)
For the high quality version of the thumbnail use a url similar to this:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg (480*360)
There is also a medium quality version of the thumbnail, using a url similar to the HQ:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg (320*180)
For the standard definition version of the thumbnail, use a url similar to this:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/sddefault.jpg (640*480)
For the maximum resolution version of the thumbnail use a url similar to this:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg (1920*1080)
All of the above urls are available over https too. Just change http to https in any of the above urls. Additionally, the slightly shorter hostname i3.ytimg.com works in place of img.youtube.com in the example urls above.
Alternatively, you can use the YouTube Data API (v3) or the older YouTube API v2.0 to get thumbnail images.

1 則留言:

  1. Emperor Casino | Shootercasino
    The Emperor Casino at Shooting Star Sydney is a fully legal, online and mobile casino that is owned and operated by the septcasino Casino at  메리트카지노 Rating: 4.5 제왕카지노 · ‎1 vote · ‎Free · ‎Game

    回覆刪除