u

유튜브 api 사용하기

· 10년 전 · 2900
스크린샷 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년 전 조회 705
10년 전 조회 1,060
10년 전 조회 1,352
10년 전 조회 1,753
10년 전 조회 3,098
10년 전 조회 1,884
10년 전 조회 2,045
10년 전 조회 2,520
10년 전 조회 4,138
10년 전 조회 1,706
10년 전 조회 886
10년 전 조회 2,577
10년 전 조회 1,019
10년 전 조회 1,259
10년 전 조회 2,022
10년 전 조회 920
10년 전 조회 945
10년 전 조회 3,237
10년 전 조회 950
10년 전 조회 824
10년 전 조회 785
10년 전 조회 714
10년 전 조회 1,250
10년 전 조회 968
10년 전 조회 846
10년 전 조회 959
10년 전 조회 1,464
10년 전 조회 2,310
10년 전 조회 1,381
10년 전 조회 1,633
10년 전 조회 2,139
10년 전 조회 1,565
10년 전 조회 1,373
10년 전 조회 1,273
10년 전 조회 4,165
10년 전 조회 932
10년 전 조회 1,253
10년 전 조회 1,830
10년 전 조회 1,282
10년 전 조회 3,011
10년 전 조회 1,240
10년 전 조회 1,152
10년 전 조회 1,256
10년 전 조회 4,814
10년 전 조회 1,114
10년 전 조회 2,656
10년 전 조회 1,963
10년 전 조회 2,585
10년 전 조회 2,166
10년 전 조회 2,901
10년 전 조회 1,073
10년 전 조회 1,339
10년 전 조회 3,143
10년 전 조회 1,508
10년 전 조회 883
10년 전 조회 1,915
10년 전 조회 1,623
10년 전 조회 1,374
10년 전 조회 1,316
10년 전 조회 1,558
10년 전 조회 1,198
10년 전 조회 840
10년 전 조회 1,632
10년 전 조회 2,094
10년 전 조회 1,628
10년 전 조회 1,653
10년 전 조회 2,335
10년 전 조회 3,399
10년 전 조회 1,001
10년 전 조회 1,033
10년 전 조회 1,537
10년 전 조회 1,737
10년 전 조회 1,282
10년 전 조회 967
10년 전 조회 1,144
10년 전 조회 1,218
10년 전 조회 1,450
10년 전 조회 1,599
10년 전 조회 2,288
10년 전 조회 930
10년 전 조회 1,120
10년 전 조회 5,240
10년 전 조회 1,018
10년 전 조회 1,478
10년 전 조회 1,421
10년 전 조회 1,891
10년 전 조회 1,335
10년 전 조회 1,577
10년 전 조회 1,654
10년 전 조회 2,037
10년 전 조회 1,814
10년 전 조회 2,640
10년 전 조회 2,044
10년 전 조회 2,138
11년 전 조회 1,222
11년 전 조회 1,475
11년 전 조회 1,466
11년 전 조회 1,105
11년 전 조회 912
11년 전 조회 1,109