본문 바로가기

CS

Youtube V3 Search API

반응형

1. 유튜브 검색으로 컨텐츠 정보 얻어오기

https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=50&q=아이유&type=video&key={KEY}

 

part = id, snippet이 있는데 id는 동영상 정보를 안가지고옴 따라서 snippet을 사용

q = 키워드 검색

type = video, chaneel 등등이 있는데 비디오 정보만 필요하기 때문에 video 사용

key = 콘솔키

maxResults = 컨텐츠 개수, 최대 100, 기본 5로 잡혀있음

 

2. 가지고온 컨텐츠 Duration 얻어오기

www.googleapis.com/youtube/v3/videos?id={VIDEO_KEY}&part=contentDetails&key={KEY}

 

id = 비디오 아이디(여러개 삽입 가능)

part = 비디오 Duration을 가지고 오기 위해선 contentDetails 삽입

 

 

 

참고 : 

 

할당량 이름 한도
Queries per day 10,000
Queries per 100 seconds per user 300,000 
Queries per 100 seconds 3,000,000 

 

위와 같이 한계치가 있고 할당량이 초과되면 다음의 에러코드가 발생

{

 "error": {

  "errors": [

   {

    "domain": "usageLimits",

    "reason": "dailyLimitExceeded",

    "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=491925861",

    "extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=49192586"

   }

  ],

  "code": 403,

  "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=49192586"

 }

}

초과된 키는 태평양 시간 기준 자정에 리셋되는 걸로 보임. 한국시간으로 따지면 오후 4시정도??

 

 

반응형

'CS' 카테고리의 다른 글

.inc 파일이란 무엇인가?  (0) 2020.11.30
MP3의 원리(저장용)  (0) 2020.11.12
Sampling Rate, Bit Rate, Channels  (0) 2020.11.01
FFMPEG이 플레이어로써 하는 일(저장용)  (0) 2020.08.28
데이터 단위  (0) 2019.10.29