데모
<?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에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5602 |
잘살아보자
|
11년 전 | 3059 | |
| 5601 |
잘살아보자
|
11년 전 | 2395 | |
| 5600 |
잘살아보자
|
11년 전 | 5727 | |
| 5599 |
잘살아보자
|
11년 전 | 3373 | |
| 5598 |
잘살아보자
|
11년 전 | 1816 | |
| 5597 |
잘살아보자
|
11년 전 | 2071 | |
| 5596 |
잘살아보자
|
11년 전 | 1330 | |
| 5595 |
잘살아보자
|
11년 전 | 1295 | |
| 5594 |
잘살아보자
|
11년 전 | 1446 | |
| 5593 | 11년 전 | 2493 | ||
| 5592 |
잘살아보자
|
11년 전 | 2315 | |
| 5591 |
잘살아보자
|
11년 전 | 2329 | |
| 5590 |
잘살아보자
|
11년 전 | 2414 | |
| 5589 |
잘살아보자
|
11년 전 | 1399 | |
| 5588 |
잘살아보자
|
11년 전 | 1876 | |
| 5587 |
잘살아보자
|
11년 전 | 1213 | |
| 5586 |
잘살아보자
|
11년 전 | 1024 | |
| 5585 | 11년 전 | 3557 | ||
| 5584 | 11년 전 | 1165 | ||
| 5583 | 11년 전 | 2405 | ||
| 5582 | 11년 전 | 1447 | ||
| 5581 | 11년 전 | 2859 | ||
| 5580 | 11년 전 | 1719 | ||
| 5579 | 11년 전 | 1684 | ||
| 5578 | 11년 전 | 1251 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기