{source}
<?php
$url = 'https://www.youtube.com/channel/UCeUWl3fHaaY2-5vMoU7t72Q';
$contents = file_get_contents($url);
preg_match_all("#\s(?:href|src|url)=(?:[\"\'])?([^'\"]+)['\"]\s*(?:title=['\"]([^'\"]+)['\"])?\s*>((?:(?!</a>).)*)#i",$contents,$title);

$array_video = array();
$count = 0;
$total = 9;
$last_id = '';
foreach ($title[0] as $video) {
        if(strstr($video,'/watch?v=')){
        $video_id = explode('">',str_replace('href="/watch?v=','',$video));
        if($last_id!=$video_id){
            $array_video[] = '<a href="https://www.youtube.com/watch?v='.trim($video_id[0]).'" id="youtube_link">
                    <div id="youtube_frame">
                        <img src="http://img.youtube.com/vi/'.trim($video_id[0]).'/0.jpg" id="youtube_img">
                 <span id="youtube_title">'.$video_id[1].'</span>
                 </div>
                 </a>';
         $count++;
         $last_id = $video_id[0];
     if($count==$total){
     break;
     }
        }
        }
}

echo '<div id="slider">
        <ul class="slides">';
for($i=0; $i<count($array_video); $i++) {
    if($i % 3 == 0){
        echo '<li class="slide"><div class="box">';
    }
    echo $array_video[$i];
    if($i % 3 == 2){
        echo '</div></li>';
    }
}
echo ' </ul>
     </div>';
?>
{/source}

 
Финальный концерт всеукраинского тура « Мы едины»
Просмотров: 339
2,50 / 2
DatsoGallery By Andrey Datso

Купить