데모
<?php
//ver1.0 150423 @_untitle_d
$yt_api = ''; //유튜브 API KEY, https://console.developers.google.com/project
function get_video_id($url){}
function youtube_info($id, $part='snippet')
{
global $yt_api;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://www.googleapis.com/youtube/v3/videos?id={$id}&key={$yt_api}&part={$part}");
curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($curl);
curl_close($curl);
return json_decode($return, true);
}
$tmp_yt = 'http://www.youtube.com/watch?v=yEJ2-VofNCw'; //유튜브 동영상
$return = youtube_info(get_video_id($tmp_yt)); //유튜브 정보
echo "동영상 : ".$tmp_yt."<br>";
echo "제목 : ".$return['items'][0]['snippet']['title']."<br>"; //title
echo "채널명 : ".$return['items'][0]['snippet']['channelTitle']."<br>"; //channelTitle
echo "썸네일 : <img src='".$return['items'][0]['snippet']['thumbnails']['default']['url']."'><br>"; //thumb default
print_r($return);
?>
관련링크
http://untitled.untitle311apyxry1w48.com/lkbmgfh
참고
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5552 |
잘살아보자
|
11년 전 | 2646 | |
| 5551 |
잘살아보자
|
11년 전 | 2224 | |
| 5550 |
잘살아보자
|
11년 전 | 1122 | |
| 5549 |
잘살아보자
|
11년 전 | 1597 | |
| 5548 |
잘살아보자
|
11년 전 | 1167 | |
| 5547 | 11년 전 | 1144 | ||
| 5546 |
잘살아보자
|
11년 전 | 1277 | |
| 5545 |
잘살아보자
|
11년 전 | 1834 | |
| 5544 | 11년 전 | 879 | ||
| 5543 | 11년 전 | 2133 | ||
| 5542 | 11년 전 | 972 | ||
| 5541 | 11년 전 | 1649 | ||
| 5540 |
잘살아보자
|
11년 전 | 1018 | |
| 5539 | 11년 전 | 1511 | ||
| 5538 | 11년 전 | 2609 | ||
| 5537 |
잘살아보자
|
11년 전 | 2244 | |
| 5536 | 11년 전 | 2280 | ||
| 5535 | 11년 전 | 3509 | ||
| 5534 |
돌아온깡통
|
11년 전 | 1062 | |
| 5533 |
돌아온깡통
|
11년 전 | 974 | |
| 5532 |
돌아온깡통
|
11년 전 | 857 | |
| 5531 |
돌아온깡통
|
11년 전 | 980 | |
| 5530 |
돌아온깡통
|
11년 전 | 757 | |
| 5529 |
돌아온깡통
|
11년 전 | 595 | |
| 5528 |
돌아온깡통
|
11년 전 | 982 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기