u

유튜브 api 사용하기

· 10년 전 · 3119
스크린샷 2015-05-06 오후 11.18.28.png

데모

 

<?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

 

 

 

 

참고

http://youtu.be/rV4sAX_WVvA 

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

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
10년 전 조회 879
10년 전 조회 1,228
10년 전 조회 1,536
10년 전 조회 1,943
10년 전 조회 3,266
10년 전 조회 2,067
10년 전 조회 2,230
10년 전 조회 2,704
10년 전 조회 4,325
10년 전 조회 1,900
10년 전 조회 1,072
10년 전 조회 2,762
10년 전 조회 1,212
10년 전 조회 1,433
10년 전 조회 2,230
10년 전 조회 1,102
10년 전 조회 1,132
10년 전 조회 3,411
10년 전 조회 1,136
10년 전 조회 1,003
10년 전 조회 974
10년 전 조회 885
10년 전 조회 1,414
10년 전 조회 1,151
10년 전 조회 1,037
10년 전 조회 1,146
10년 전 조회 1,668
10년 전 조회 2,512
10년 전 조회 1,559
10년 전 조회 1,817
10년 전 조회 2,348
10년 전 조회 1,759
10년 전 조회 1,544
10년 전 조회 1,488
10년 전 조회 4,360
10년 전 조회 1,123
10년 전 조회 1,454
10년 전 조회 2,004
10년 전 조회 1,468
10년 전 조회 3,206
10년 전 조회 1,423
10년 전 조회 1,335
10년 전 조회 1,444
10년 전 조회 4,994
10년 전 조회 1,305
10년 전 조회 2,905
10년 전 조회 2,142
10년 전 조회 2,802
10년 전 조회 2,408
10년 전 조회 3,120
10년 전 조회 1,272
10년 전 조회 1,535
10년 전 조회 3,344
10년 전 조회 1,698
10년 전 조회 1,083
10년 전 조회 2,090
10년 전 조회 1,810
10년 전 조회 1,557
10년 전 조회 1,502
10년 전 조회 1,761
10년 전 조회 1,403
10년 전 조회 1,027
10년 전 조회 1,827
10년 전 조회 2,306
10년 전 조회 1,850
10년 전 조회 1,840
10년 전 조회 2,515
10년 전 조회 3,614
10년 전 조회 1,197
10년 전 조회 1,218
10년 전 조회 1,728
10년 전 조회 1,936
10년 전 조회 1,479
10년 전 조회 1,160
10년 전 조회 1,332
10년 전 조회 1,417
10년 전 조회 1,630
10년 전 조회 1,773
10년 전 조회 2,496
10년 전 조회 1,104
10년 전 조회 1,310
10년 전 조회 5,419
10년 전 조회 1,197
10년 전 조회 1,658
10년 전 조회 1,613
10년 전 조회 2,073
10년 전 조회 1,509
10년 전 조회 1,765
11년 전 조회 1,836
11년 전 조회 2,211
11년 전 조회 1,979
11년 전 조회 2,837
11년 전 조회 2,244
11년 전 조회 2,338
11년 전 조회 1,405
11년 전 조회 1,665
11년 전 조회 1,640
11년 전 조회 1,295
11년 전 조회 1,114
11년 전 조회 1,287