YouTube: получите заголовок YouTube + изображение + описание, например, Facebook
Сейчас я использую
<?php
// Replace Youtube URLs with embed code
function embedYoutube($text)
{
$search = '% # Match any youtube URL in the wild.
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
youtu\.be/ # Either youtu.be,
| youtube\.com # or youtube.com
(?: # Group path alternatives
/embed/ # Either /embed/
| /v/ # or /v/
| /watch\?v= # or /watch\?v=
) # End path alternatives.
) # End host alternatives.
([\w\-]{10,12}) # Allow 10-12 for 11 char youtube id.
\b # Anchor end to word boundary.
%x';
$replace = '<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/$1?fs=1"</param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="http://www.youtube.com/v/$1?fs=1"
type="application/x-shockwave-flash" allowscriptaccess="always" allowFullScreen="true" width="425" height="344">
</embed>
</object>';
return preg_replace($search, $replace, $text);
}
$string = 'Video1'.
'http://www.youtube.com/watch?v=NLqAF9hrVbY'."\n".
'http://www.youtube.com/v/u1zgFlCw8Aw';
echo embedYoutube($string);
?>
для встраивания видео на YouTube, но мне нужно полное описание + заголовок + ссылка на источникдля видео, которое будет отображаться вместе с ним.У кого-нибудь есть ответ.