witnessmenow / arduino-youtube-api

A wrapper around the youtube api for arduino
MIT License
141 stars 48 forks source link

Connection Failed #28

Closed t-po closed 4 years ago

t-po commented 4 years ago

Hi all,

I have an issue with my Data Youtube API.

When I use the Channel Statistics with my personal information, I got en HTML code status 403 and when I try it on my web browser it shows that I have reach my maximum quota, but I did not. I've made 1506 requests and my max by day is 10 000. Does someone knows what is happening please ?

Thanks in advance

my program : /*** Read YouTube Channel statistics from the YouTube API on an ESP8266 and print them to the serial monitor

Parts:
D1 Mini ESP8266 (or any ESP8266) * - http://s.click.aliexpress.com/e/uzFUnIe
* = Affilate

If you find what I do useful and would like to support me,
please consider becoming a sponsor on Github
https://github.com/sponsors/witnessmenow/

Written by Brian Lough
YouTube: https://www.youtube.com/brianlough
Tindie: https://www.tindie.com/stores/brianlough/
Twitter: https://twitter.com/witnessmenow

***/

// ---------------------------- // Standard Libraries // ----------------------------

include

include

// ---------------------------- // Additional Libraries - each one of these will need to be installed. // ----------------------------

include

// Library for connecting to the Youtube API

// Search for "youtube" in the Arduino Library Manager // https://github.com/witnessmenow/arduino-youtube-api

include

// Library used for parsing Json from the API responses

// Search for "Arduino Json" in the Arduino Library manager // https://github.com/bblanchon/ArduinoJson

//------- REMPLACER char ssid[] = "Evolukid"; // NOM DU RESEAU WIFI char password[] = "/Wifi password/"; // MOT DE PASSE

define API_KEY "/My valid API Key/" // CLE API GOOGLE

define CHANNEL_ID "UC-52Xp-LLQjBwL-3jINyb-Q" // makes up the url of channel

//------- ---------------------- ------

WiFiClientSecure client; YoutubeApi api(API_KEY, client);

unsigned long timeBetweenRequests = 3000; unsigned long nextRunTime;

long subs = 0;

void setup() {

Serial.begin(115200);

// Set WiFi to station mode and disconnect from an AP if it was Previously // connected WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100);

// Attempt to connect to Wifi network: Serial.print("Connecting Wifi: "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); IPAddress ip = WiFi.localIP(); Serial.println(ip);

// Required if you are using ESP8266 V2.5 or above client.setInsecure();

// If you want to enable some extra debugging api._debug = true; }

void loop() {

if (millis() > nextRunTime) { if(api.getChannelStatistics(CHANNEL_ID)) { Serial.println("---------Stats---------"); Serial.print("Subscriber Count: "); Serial.println(api.channelStats.subscriberCount); Serial.print("View Count: "); Serial.println(api.channelStats.viewCount); Serial.print("Comment Count: "); Serial.println(api.channelStats.commentCount); Serial.print("Video Count: "); Serial.println(api.channelStats.videoCount); // Probably not needed :) //Serial.print("hiddenSubscriberCount: "); //Serial.println(api.channelStats.hiddenSubscriberCount); Serial.println("------------------------");

}
nextRunTime = millis() + timeBetweenRequests;

} }

witnessmenow commented 4 years ago

Provide details please

t-po commented 4 years ago

Provide details please

yes sorry I've failed when I created the issue