{"id":888,"date":"2013-11-05T14:09:35","date_gmt":"2013-11-05T14:09:35","guid":{"rendered":"http:\/\/codebangers.com\/?p=888"},"modified":"2013-11-05T14:12:22","modified_gmt":"2013-11-05T14:12:22","slug":"get-youtube-thumbnails-with-php-or-html","status":"publish","type":"post","link":"https:\/\/codebangers.com\/get-youtube-thumbnails-with-php-or-html\/","title":{"rendered":"Get Youtube Thumbnails with PHP or Html"},"content":{"rendered":"<p>Each YouTube video has 4 generated images. They are predictably formatted as follows:<\/p>\n<pre><code>http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/0.jpg\r\nhttp:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/1.jpg\r\nhttp:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/2.jpg\r\nhttp:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/3.jpg<\/code><\/pre>\n<p>The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg,\u00a02.jpg,\u00a03.jpg) is:<\/p>\n<pre><code>http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/default.jpg<\/code><\/pre>\n<p>For the high quality version of the thumbnail use a url similar to this:<\/p>\n<pre><code>http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/hqdefault.jpg<\/code><\/pre>\n<p>There is also a medium quality version of the thumbnail, using a url similar to the HQ:<\/p>\n<pre><code>http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/mqdefault.jpg<\/code><\/pre>\n<p>For the standard definition version of the thumbnail, use a url similar to this:<\/p>\n<pre><code>http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/sddefault.jpg<\/code><\/pre>\n<p>For the maximum resolution version of the thumbnail use a url similar to this:<\/p>\n<pre><code>http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/maxresdefault.jpg<\/code><\/pre>\n<p>All of the above urls are available over https too. Just change\u00a0<code>http<\/code>\u00a0to\u00a0<code>https<\/code>\u00a0in any of the above urls. Additionally, the slightly shorter hostname\u00a0<code>i3.ytimg.com<\/code>\u00a0works in place of\u00a0<code>img.youtube.com<\/code>\u00a0in the example urls above.<\/p>\n<p>Alternatively, you can use the\u00a0<a href=\"https:\/\/developers.google.com\/youtube\/v3\/\" target=\"_blank\" rel=\"noopener\">YouTube Data API (v3)<\/a>\u00a0or the older\u00a0<a href=\"http:\/\/code.google.com\/apis\/youtube\/2.0\/developers_guide_php.html\" target=\"_blank\" rel=\"noopener\">YouTube API v2.0<\/a>\u00a0to get thumbnail images.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Each YouTube video has 4 generated images. They are predictably formatted as follows: http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/0.jpg http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/1.jpg http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/2.jpg http:\/\/img.youtube.com\/vi\/&lt;insert-youtube-video-id-here&gt;\/3.jpg The first one in the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":889,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,4],"tags":[],"class_list":["post-888","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howto","category-php"],"_links":{"self":[{"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/posts\/888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/comments?post=888"}],"version-history":[{"count":3,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/posts\/888\/revisions"}],"predecessor-version":[{"id":896,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/posts\/888\/revisions\/896"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/media\/889"}],"wp:attachment":[{"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/media?parent=888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/categories?post=888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codebangers.com\/wp-json\/wp\/v2\/tags?post=888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}