애플리케이션에서 다른 범위에 대한 액세스를 요청해야 할 수도 있습니다. 예를 들어 YouTube Analytics API 및 YouTube Data API를 호출하는 애플리케이션은 사용자에게 YouTube 계정에 대한 액세스 권한도 부여해야 할 수 있습니다. 승인 개요에서는 YouTube Analytics API를 호출하는 애플리케이션에서 일반적으로 사용되는 범위를 식별합니다.
일일 채널 통계 검색
이 예에서는 YouTube Analytics API를 호출하여 2017년을 승인하는 사용자의 채널에 대한 일일 조회수 및 기타 측정항목을 검색합니다. 이 샘플은 Google API 자바스크립트 클라이언트 라이브러리를 사용합니다.
승인 사용자 인증 정보 설정
이 샘플을 처음으로 로컬에서 실행하기 전에 프로젝트에 대한 승인 사용자 인증 정보를 설정해야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2023-02-22(UTC)"],[[["This sample code uses the Google APIs Client Library for JavaScript to retrieve daily views and other metrics for a YouTube channel for the 2017 calendar year, utilizing the YouTube Analytics API."],["The code requests user permission to access the `https://www.googleapis.com/auth/yt-analytics.readonly` scope to read YouTube Analytics data."],["Setting up authorization credentials in the Google API Console is required, including creating an OAuth client ID, enabling the YouTube Analytics API, and entering authorized JavaScript origins."],["The sample requires replacing `\u003cvar translate=\"no\"\u003eYOUR_CLIENT_ID\u003c/var\u003e` with the client ID obtained from the Google API Console in order to run."],["To run the code, users must authorize the application, load the API client, and execute the API query by clicking buttons in the browser, with successful operations and responses being logged in the browser's console."]]],["The code uses the Google APIs Client Library for JavaScript to retrieve YouTube channel statistics. It requires user authorization for the `https://www.googleapis.com/auth/yt-analytics.readonly` scope. Users need to create authorization credentials in the Google API Console, enabling the YouTube Analytics API. The client ID must be added to the code sample, which is loaded from a specified URL. Upon running, the code allows authorization and data retrieval, displaying daily channel metrics (views, watch time, etc.) for 2017.\n"]]