{"id":118500,"date":"2013-10-22T13:41:25","date_gmt":"2013-10-22T13:41:25","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/2013\/10\/22\/%d0%98%d0%b7%d0%bc%d0%b5%d0%bd%d0%b8%d1%82%d1%8c-%d1%88%d0%b0%d0%b1%d0%bb%d0%be%d0%bd-1\/"},"modified":"2013-10-22T13:41:25","modified_gmt":"2013-10-22T13:41:25","slug":"%d0%98%d0%b7%d0%bc%d0%b5%d0%bd%d0%b8%d1%82%d1%8c-%d1%88%d0%b0%d0%b1%d0%bb%d0%be%d0%bd-1","status":"closed","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%98%d0%b7%d0%bc%d0%b5%d0%bd%d0%b8%d1%82%d1%8c-%d1%88%d0%b0%d0%b1%d0%bb%d0%be%d0%bd-1\/","title":{"rendered":"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d"},"content":{"rendered":"<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0412 \u043c\u043e\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e \u0441 \u044e\u0442\u0443\u0431\u0430 \u0438 \u043f\u0440\u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 html \u043a\u043e\u0434\u0430, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u0430 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430) \u043a \u044d\u0442\u043e\u043c\u0443 \u0432\u0438\u0434\u0435\u043e. Html \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0442\u0438\u043f (&#8230;..src=&#187;http:\/\/www.youtube.com\/&#8230;..), \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u044e\u0442\u0443\u0431 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043e\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 (&#8230;..src=&#187;\/\/www.youtube.com\/&#8230;..). \u041c\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434 \u043d\u0435 \u0432\u0438\u0434\u0438\u0442, \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e \u0431\u044b \u0432\u043f\u0435\u0440\u0435\u0434\u0438 \u0441\u0442\u043e\u044f\u043b\u043e &#171;http:&#187;. \u0427\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435, \u0447\u0442\u043e \u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u0443, \u043a\u043e\u0433\u0434\u0430 \u0432\u043f\u0435\u0440\u0435\u0434\u0438 \u043d\u0435\u0442 http??? \u041f\u043e\u043c\u043e\u0433\u0438\u0442\u0435! \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435:<\/p>\n<pre><code>function fetch_video_thumbnail_url($input) {\n    $input = htmlspecialchars_decode(trim((stripos($input, &#039;&lt;iframe&#039;) !== false || stripos($input, &#039;&lt;embed&#039;) !== false) &amp;&amp; preg_match(&#039;#src=&quot;([^&quot;]+)&quot;#i&#039;, $input, $match) ? $match[1] : $input), ENT_QUOTES);\n    $out = false;\n    if(filter_var($input, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) !== false &amp;&amp; false !== ($url_parts=parse_url($input)) &amp;&amp; (stripos($url_parts[&#039;host&#039;], &#039;youtube.com&#039;) !== false || stripos($url_parts[&#039;host&#039;], &#039;youtu.be&#039;) !== false || stripos($url_parts[&#039;host&#039;], &#039;vimeo.com&#039;) !== false)) {\n        $url_query = array();if(isset($url_parts[&#039;query&#039;]))parse_str($url_parts[&#039;query&#039;],$url_query);\n        $id = isset($url_query[&#039;v&#039;]) ? $url_query[&#039;v&#039;] : (isset($url_query[&#039;clip_id&#039;]) ? $url_query[&#039;clip_id&#039;] : reset(explode(&#039;?&#039;, end(array_filter(explode(&#039;\/&#039;, $input))))));\n\n    if(stripos($url_parts[&#039;host&#039;], &#039;youtube.com&#039;) !== false || stripos($url_parts[&#039;host&#039;], &#039;youtu.be&#039;) !== false) {\n        if(false !== ($contents = @file_get_contents(&quot;http:\/\/gdata.youtube.com\/feeds\/api\/videos\/$id?v=2&amp;alt=jsonc&quot;))) {\n            $obj = json_decode($contents, true);\n            $out = $obj[&#039;data&#039;][&#039;thumbnail&#039;][&#039;hqDefault&#039;];\n        }\n    }elseif(stripos($url_parts[&#039;host&#039;], &#039;vimeo.com&#039;) !== false) {\n        if(false !== ($contents = @file_get_contents(&quot;http:\/\/vimeo.com\/api\/v2\/video\/$id.php&quot;))) {\n            $obj = unserialize($contents);\n            $out = $obj[0][&#039;thumbnail_large&#039;];\n        }\n        }\n    }\n    return $out;\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-118500","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/118500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/118500\/revisions"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=118500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}