Código:
En teoría todo bien. Le doy al botón de authorize y me autoriza todo OK. Pero luego le doy a ejecutar y me da el siguiente error: "The request cannot be completed because you have exceeded your quota". He estado viendo en la consola de google si hay alguna restricción de quota y no veo que haya ninguna, además es que no me deja hacer ni un intento, al primer intento ya me da este error.<?php $apiKey = "AIzaxxxx"; $clientId = "8824xxxx"; $channelId = "UCoM0y3xxxx"; $videoId = "iouKxxxxx"; ?> <script src="https://apis.google.com/js/api.js"></script> <script> /** * Sample JavaScript code for youtube.commentThreads.insert * See instructions for running APIs Explorer code samples locally: * https://developers.google.com/explorer-help/code-samples#javascript */ function authenticate() { return gapi.auth2.getAuthInstance() .signIn({scope: "https://www.googleapis.com/auth/youtube.force-ssl"}) .then(function() { console.log("Sign-in successful"); }, function(err) { console.error("Error signing in", err); }); } function loadClient() { gapi.client.setApiKey("<?=$apiKey;?>"); return gapi.client.load("https://www.googleapis.com/discovery/v1/apis/youtube/v3/rest") .then(function() { console.log("GAPI client loaded for API"); }, function(err) { console.error("Error loading GAPI client for API", err); }); } // Make sure the client is loaded and sign-in is complete before calling this method. function execute() { return gapi.client.youtube.commentThreads.insert({ "part": [ "snippet" ], "resource": { "snippet": { "topLevelComment": { "snippet": { "textOriginal": "prueba tres", "channelId": "<?=$channelId;?>", "videoId": "<?=$videoId;?>" } } } } }) .then(function(response) { // Handle the results here (response.result has the parsed body). console.log("Response", response); }, function(err) { console.error("Execute error", err); }); } gapi.load("client:auth2", function() { gapi.auth2.init({client_id: "<?=$clientId;?>"}); }); </script> <button onclick="authenticate().then(loadClient)">authorize and load</button> <button onclick="execute()">execute</button>
También lo he intentando hacer mediante el código de PHP en vez de Javascript pero me da el mismo error.
¿Alguno de vosotros ha podido publicar desde una web comentarios directamente en un vídeo de YouTube? ¿Cómo lo habéis conseguido? ¿Qué código usáis?
Muchas gracias por adelantado.