테스트 사이트 - 개발 중인 베타 버전입니다

이젠 도움은 이것 뿐이 못드리겠네요 유트브 뽑기 api

    <title>Listing most viewed videos</title>
    <style type="text/css">
    div.item {
      border-top: solid black 1px;     
      margin: 10px;
      padding: 2px;
      width: auto;
      padding-bottom: 20px;
    }
    span.thumbnail {
      float: left;
      margin-right: 20px;
      padding: 2px;
      border: solid silver 1px; 
      font-size: x-small;
      text-align: center
    }   
    span.attr {
      font-weight: bolder; 
    }
    span.title {
      font-weight: bolder; 
      font-size: x-large
    }
    img {
      border: 0px; 
    }   
    a {
      color: brown;
      text-decoration: none; 
    }
    </style>
  </head>
  <body>
    <?php
    // 피드 URL 설정
    $feedURL = 'http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed';
   
    // 피드를 SimpleXML 객체로 읽음
    $sxml = simplexml_load_file($feedURL);
    ?>
      <h1><?php echo $sxml->title; ?></h1>
    <?php
    // 피드에서 항목을 순회함
    foreach ($sxml->entry as $entry) {
      // get nodes in media: namespace for media information
      $media = $entry->children('http://search.yahoo.com/mrss/');
     
      // 비디오 재생기 URL 얻기
      $attrs = $media->group->player->attributes();
      $watch = $attrs['url'];
     
      // 동영상 축소판 이미지 얻기
      $attrs = $media->group->thumbnail[0]->attributes();
      $thumbnail = $attrs['url'];
           
      // 동영상 길이를 얻기 위해 <yt:duration> 노드 탐색
      $yt = $media->children('http://gdata.youtube.com/schemas/2007');
      $attrs = $yt->duration->attributes();
      $length = $attrs['seconds'];
     
      // 접근 횟수 통계를 얻기 위해 <yt:stats> 노드 탐색
      $yt = $entry->children('http://gdata.youtube.com/schemas/2007');
      $attrs = $yt->statistics->attributes();
      $viewCount = $attrs['viewCount'];
     
      // 동영상 평가 점수를 얻기 위해 <gd:rating> 노드 탐색
      $gd = $entry->children('http://schemas.google.com/g/2005');
      if ($gd->rating) {
        $attrs = $gd->rating->attributes();
        $rating = $attrs['average'];
      } else {
        $rating = 0;
      }
      ?>
      <div class="item">
        <span class="title">
          <a href="<?php echo $watch; ?>"><?php echo $media->group->title; ?></a>
        </span>
        <p><?php echo $media->group->description; ?></p>
        <p>
          <span class="thumbnail">
            <a href="<?php echo $watch; ?>"><img src="<?php echo $thumbnail;?>" /></a>
            <br/>click to view
          </span>
          <span class="attr">By:</span> <?php echo $entry->author->name; ?> <br/>
          <span class="attr">Duration:</span> <?php printf('%0.2f', $length/60); ?>
          min. <br/>
          <span class="attr">Views:</span> <?php echo $viewCount; ?> <br/>
          <span class="attr">Rating:</span> <?php echo $rating; ?>
        </p>
      </div>     
    <?php
    }
    ?>
좋은 스킨/좋은 프로그램만드시길...
높이 나는 새가 멀리본다는 말이 있습니다. 도전하는 자만이  세상을 넓게 볼수 있겠죠 .....
모두가 최고 1인이 될수 있습니다. 노력 하시길 바랍니다.
 
저에게 악의 없는분중 다른 보드에 절 만나시더라도 좋은 인연이 되었으면 좋겠습니다. 이만.... 그누보드 회이팅입니다.!!

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 4개

잘 활용할께요
사용예제 : http://fun.munstar.com/plugin/youtube/
감사합니다.
simplexml_load_file 의 함수는 어디에 있나요?

게시글 목록

번호 제목
34706
34693
34563
34536
34521
34480
34479
34466
34437
34436
34435
34406
34398
34387
34382
34375
34364
34336
34294
34293