u

유튜브 api 사용하기

· 10년 전 · 3240
스크린샷 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년 전 조회 995
10년 전 조회 1,356
10년 전 조회 1,659
10년 전 조회 2,054
10년 전 조회 3,380
10년 전 조회 2,198
10년 전 조회 2,342
10년 전 조회 2,807
10년 전 조회 4,452
10년 전 조회 2,016
10년 전 조회 1,194
10년 전 조회 2,930
10년 전 조회 1,329
10년 전 조회 1,562
10년 전 조회 2,349
10년 전 조회 1,217
10년 전 조회 1,259
10년 전 조회 3,560
10년 전 조회 1,255
10년 전 조회 1,142
10년 전 조회 1,107
10년 전 조회 1,024
10년 전 조회 1,553
10년 전 조회 1,286
10년 전 조회 1,154
10년 전 조회 1,262
10년 전 조회 1,784
10년 전 조회 2,693
10년 전 조회 1,694
10년 전 조회 1,945
10년 전 조회 2,489
10년 전 조회 1,874
10년 전 조회 1,664
10년 전 조회 1,619
10년 전 조회 4,476
10년 전 조회 1,271
10년 전 조회 1,595
10년 전 조회 2,129
10년 전 조회 1,599
10년 전 조회 3,336
10년 전 조회 1,548
10년 전 조회 1,454
10년 전 조회 1,567
10년 전 조회 5,122
10년 전 조회 1,432
10년 전 조회 3,015
10년 전 조회 2,273
10년 전 조회 2,925
10년 전 조회 2,528
10년 전 조회 3,241
10년 전 조회 1,401
10년 전 조회 1,663
10년 전 조회 3,465
10년 전 조회 1,840
10년 전 조회 1,226
10년 전 조회 2,218
10년 전 조회 1,958
10년 전 조회 1,704
10년 전 조회 1,648
10년 전 조회 1,879
10년 전 조회 1,518
10년 전 조회 1,155
10년 전 조회 1,953
10년 전 조회 2,416
10년 전 조회 1,973
10년 전 조회 1,960
10년 전 조회 2,639
10년 전 조회 3,714
10년 전 조회 1,333
10년 전 조회 1,335
10년 전 조회 1,863
10년 전 조회 2,049
10년 전 조회 1,598
10년 전 조회 1,275
10년 전 조회 1,440
10년 전 조회 1,550
10년 전 조회 1,768
10년 전 조회 1,916
10년 전 조회 2,621
10년 전 조회 1,217
10년 전 조회 1,437
10년 전 조회 5,540
10년 전 조회 1,329
10년 전 조회 1,794
10년 전 조회 1,738
10년 전 조회 2,210
10년 전 조회 1,641
11년 전 조회 1,890
11년 전 조회 1,954
11년 전 조회 2,333
11년 전 조회 2,106
11년 전 조회 2,969
11년 전 조회 2,375
11년 전 조회 2,465
11년 전 조회 1,551
11년 전 조회 1,792
11년 전 조회 1,782
11년 전 조회 1,435
11년 전 조회 1,236
11년 전 조회 1,422