u

유튜브 api 사용하기

· 10년 전 · 2879
스크린샷 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년 전 조회 685
10년 전 조회 1,043
10년 전 조회 1,334
10년 전 조회 1,735
10년 전 조회 3,074
10년 전 조회 1,858
10년 전 조회 2,027
10년 전 조회 2,507
10년 전 조회 4,113
10년 전 조회 1,688
10년 전 조회 860
10년 전 조회 2,548
10년 전 조회 1,002
10년 전 조회 1,238
10년 전 조회 2,004
10년 전 조회 891
10년 전 조회 923
10년 전 조회 3,212
10년 전 조회 925
10년 전 조회 802
10년 전 조회 768
10년 전 조회 693
10년 전 조회 1,227
10년 전 조회 944
10년 전 조회 826
10년 전 조회 935
10년 전 조회 1,448
10년 전 조회 2,289
10년 전 조회 1,366
10년 전 조회 1,609
10년 전 조회 2,124
10년 전 조회 1,533
10년 전 조회 1,349
10년 전 조회 1,246
10년 전 조회 4,143
10년 전 조회 917
10년 전 조회 1,230
10년 전 조회 1,809
10년 전 조회 1,271
10년 전 조회 2,982
10년 전 조회 1,222
10년 전 조회 1,134
10년 전 조회 1,237
10년 전 조회 4,789
10년 전 조회 1,096
10년 전 조회 2,630
10년 전 조회 1,938
10년 전 조회 2,572
10년 전 조회 2,143
10년 전 조회 2,880
10년 전 조회 1,061
10년 전 조회 1,312
10년 전 조회 3,125
10년 전 조회 1,485
10년 전 조회 863
10년 전 조회 1,892
10년 전 조회 1,602
10년 전 조회 1,358
10년 전 조회 1,292
10년 전 조회 1,541
10년 전 조회 1,180
10년 전 조회 809
10년 전 조회 1,607
10년 전 조회 2,067
10년 전 조회 1,593
10년 전 조회 1,635
10년 전 조회 2,313
10년 전 조회 3,383
10년 전 조회 979
10년 전 조회 1,010
10년 전 조회 1,520
10년 전 조회 1,719
10년 전 조회 1,263
10년 전 조회 947
10년 전 조회 1,123
10년 전 조회 1,200
10년 전 조회 1,426
10년 전 조회 1,577
10년 전 조회 2,263
10년 전 조회 912
10년 전 조회 1,105
10년 전 조회 5,214
10년 전 조회 1,000
10년 전 조회 1,455
10년 전 조회 1,401
10년 전 조회 1,872
10년 전 조회 1,307
10년 전 조회 1,548
10년 전 조회 1,622
10년 전 조회 2,020
10년 전 조회 1,789
10년 전 조회 2,619
10년 전 조회 2,019
10년 전 조회 2,116
11년 전 조회 1,202
11년 전 조회 1,455
11년 전 조회 1,444
11년 전 조회 1,081
11년 전 조회 894
11년 전 조회 1,086