Error de Youtube Analytics API 403

Hola, me gustaría saber algo.

sigo los pasos en el sitio web

pero cuando inicio mi aplicación siempre tengo este mensaje:

"Límite diario para el uso no autenticado excedido. El uso continuo requiere registro".

Tengo 2 enlaces. 1 para conectar en youtube (0auth) cómo funciona y dame el token y un segundo enlace que me da la métrica, la dimensión ... en json. pero no tengo nada excepto el mensaje en la parte superior. js página:

(function() {
// Retrieve your client ID from the Google Developers Console at
var OAUTH2_CLIENT_ID = '';


var ONE_MONTH_IN_MILLISECONDS = 1000 * 60 * 60 * 24 * 30;

// Keep track of the currently authenticated user's YouTube channel ID.
var channelId;

// For information about the Google Chart Tools API, see:
google.load('visualization', '1.0', {'packages': ['corechart']});

// Upon loading, the Google APIs JS client automatically invokes this callback.
// See
window.onJSClientLoad = function() {
    gapi.auth.init(function() {
        window.setTimeout(checkAuth, 1);

// Attempt the immediate OAuth 2.0 client flow as soon as the page loads.
// If the currently logged-in Google Account has previously authorized
// the client specified as the OAUTH2_CLIENT_ID, then the authorization
// succeeds with no user intervention. Otherwise, it fails and the
// user interface that prompts for authorization needs to display.
function checkAuth() {
        client_id: OAUTH2_CLIENT_ID,
        scope: OAUTH2_SCOPES,
        immediate: true
    }, handleAuthResult);

// Handle the result of a gapi.auth.authorize() call.
function handleAuthResult(authResult) {
    if (authResult) {
        // Authorization was successful. Hide authorization prompts and show
        // content that should be visible after authorization succeeds.

    } else {
        // Authorization was unsuccessful. Show content related to prompting for
        // authorization and hide content that should be visible if authorization
        // succeeds.

        // Make the #login-link clickable. Attempt a non-immediate OAuth 2.0
        // client flow. The current function is called when that flow completes.
        $('#login-link').click(function() {
                client_id: OAUTH2_CLIENT_ID,
                scope: OAUTH2_SCOPES,
                immediate: false
            }, handleAuthResult);

// Load the client interfaces for the YouTube Analytics and Data APIs, which
// are required to use the Google APIs JS client. More info is available at
function loadAPIClientInterfaces() {
    gapi.client.load('youtube', 'v3', function() {
        gapi.client.load('youtubeAnalytics', 'v1', function() {
            // After both client interfaces load, use the Data API to request
            // information about the authenticated user's channel.

// Call the Data API to retrieve information about the currently
// authenticated user's YouTube channel.
function getUserChannel() {
    // Also see:
    var request ={
        // Setting the "mine" request parameter's value to "true" indicates that
        // you want to retrieve the currently authenticated user's channel.
        mine: true,
        part: 'id,contentDetails'

    request.execute(function(response) {
        if ('error' in response) {
        } else {
            // We need the channel's channel ID to make calls to the Analytics API.
            // The channel ID value has the form "UCdLFeWKpkLhkguiMZUp8lWA".
            channelId = response.items[0].id;
            // Retrieve the playlist ID that uniquely identifies the playlist of
            // videos uploaded to the authenticated user's channel. This value has
            // the form "UUdLFeWKpkLhkguiMZUp8lWA".
            var uploadsListId = response.items[0].contentDetails.relatedPlaylists.uploads;
            // Use the playlist ID to retrieve the list of uploaded videos.

// Call the Data API to retrieve the items in a particular playlist. In this
// example, we are retrieving a playlist of the currently authenticated user's
// uploaded videos. By default, the list returns the most recent videos first.
function getPlaylistItems(listId) {
    // See
    var request ={
        playlistId: listId,
        part: 'snippet'

    request.execute(function(response) {
        if ('error' in response) {
        } else {
            if ('items' in response) {
                // The function iterates through all of the items in
                // the response and creates a new array that only contains the
                // specific property we're looking for: videoId.
                var videoIds = $.map(response.items, function(item) {
                    return item.snippet.resourceId.videoId;

                // Now that we know the IDs of all the videos in the uploads list,
                // we can retrieve information about each video.
            } else {
                displayMessage('There are no videos in your channel.');

// Given an array of video IDs, this function obtains metadata about each
// video and then uses that metadata to display a list of videos.
function getVideoMetadata(videoIds) {
    var request ={
        // The 'id' property's value is a comma-separated string of video IDs.
        id: videoIds.join(','),
        part: 'id,snippet,statistics'

    request.execute(function(response) {
        if ('error' in response) {
        } else {
            // Get the jQuery wrapper for the #video-list element before starting
            // the loop.
            var videoList = $('#video-list');
            $.each(response.items, function() {
                // Exclude videos that do not have any views, since those videos
                // will not have any interesting viewcount Analytics data.
                if (this.statistics.viewCount == 0) {

                var title = this.snippet.title;
                var videoId =;

                // Create a new <li> element that contains an <a> element.
                // Set the <a> element's text content to the video's title, and
                // add a click handler that will display Analytics data when invoked.
                var liElement = $('<li>');
                var aElement = $('<a>');
                // Setting the href value to '#' ensures that the browser renders the
                // <a> element as a clickable link.
                aElement.attr('href', '#');

                // Call the jQuery.append() method to add the new <a> element to
                // the <li> element, and the <li> element to the parent
                // list, which is identified by the 'videoList' variable.

            if (videoList.children().length == 0) {
                // Display a message if the channel does not have any viewed videos.
                displayMessage('Your channel does not have any videos that have been viewed.');

// This function requests YouTube Analytics data for a video and displays
// the results in a chart.
function displayVideoAnalytics(videoId) {
    if (channelId) {
        // To use a different date range, modify the ONE_MONTH_IN_MILLISECONDS
        // variable to a different millisecond delta as desired.
        var today = new Date();
        var lastMonth = new Date(today.getTime() - ONE_MONTH_IN_MILLISECONDS);

        var request = gapi.client.youtubeAnalytics.reports.query({
            // The start-date and end-date parameters must be YYYY-MM-DD strings.
            'start-date': formatDateString(lastMonth),
            'end-date': formatDateString(today),
            // At this time, you need to explicitly specify channel==channelId.
            // See
            ids: 'channel==' + channelId,
            dimensions: 'day',
            sort: 'day',
            // See
            // for details about the different filters and metrics you can request
            // if the "dimensions" parameter value is "day".
            metrics: 'views',
            filters: 'video==' + videoId

        request.execute(function(response) {
            // This function is called regardless of whether the request succeeds.
            // The response contains YouTube Analytics data or an error message.
            if ('error' in response) {
            } else {
                displayChart(videoId, response);
    } else {
        // The currently authenticated user's channel ID is not available.
        displayMessage('The YouTube channel ID for the current user is not available.');

// This boilerplate code takes a Date object and returns a YYYY-MM-DD string.
function formatDateString(date) {
    var yyyy = date.getFullYear().toString();
    var mm = padToTwoCharacters(date.getMonth() + 1);
    var dd = padToTwoCharacters(date.getDate());

    return yyyy + '-' + mm + '-' + dd;

// If number is a single digit, prepend a '0'. Otherwise, return the number
//  as a string.
function padToTwoCharacters(number) {
    if (number < 10) {
        return '0' + number;
    } else {
        return number.toString();

// Call the Google Chart Tools API to generate a chart of Analytics data.
function displayChart(videoId, response) {
    if ('rows' in response) {

        // The columnHeaders property contains an array of objects representing
        // each column's title -- e.g.: [{name:"day"},{name:"views"}]
        // We need these column titles as a simple array, so we call
        // to get each element's "name" property and create a new array that only
        // contains those values.
        var columns = $.map(response.columnHeaders, function(item) {
        // The google.visualization.arrayToDataTable() function wants an array
        // of arrays. The first element is an array of column titles, calculated
        // above as "columns". The remaining elements are arrays that each
        // represent a row of data. Fortunately, response.rows is already in
        // this format, so it can just be concatenated.
        // See
        var chartDataArray = [columns].concat(response.rows);
        var chartDataTable = google.visualization.arrayToDataTable(chartDataArray);

        var chart = new google.visualization.LineChart(document.getElementById('chart'));
        chart.draw(chartDataTable, {
            // Additional options can be set if desired as described at:
            title: 'Views per Day of Video ' + videoId
    } else {
        displayMessage('No data available for video ' + videoId);

// This helper method displays a message on the page.
function displayMessage(message) {

// This helper method hides a previously displayed message on the page.
function hideMessage() {

}) ();

y página html:

<!doctype html>
    <title>Sample YouTube Analytics API Implementation</title>
    <link type="text/css" rel="stylesheet" href="/index.css">
    <script type="text/javascript" src="//"></script>
    <script type="text/javascript" src="//"></script>
    <script type="text/javascript" src="/index.js"></script>
    <script type="text/javascript" src=""></script>
<div id="login-container" class="pre-auth">This application requires access to your YouTube account.
    Please <a href="#" id="login-link">authorize</a> to continue.
<div class="post-auth">
    <div id="message"></div>
    <div id="chart"></div>
    <div>Choose a Video:</div>
    <ul id="video-list"></ul>
<a class="plain" href="" target="_blank">
    get token </a>
<a class="result" href="">
    to see resultat
    //(function() {
    function getUrlVars()
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1).split('&');
        for(var i = 0; i < hashes.length; i++)
            hash = hashes[i].split('=');
            vars[hash[0]] = hash[1];
        return vars;
            var token = getUrlVars()['access_token'];
            $('.result').attr('href', ',views,likes&dimensions=month&access_token=' + token);

Respuestas a la pregunta(3)

Su respuesta a la pregunta