A wrapper for the YouTube API for Arduino (works on ESP8266)
Currently the only implemented method is getting the channel statistics but it can be easily extended. Please raise an issue if there is a method you are looking for.
- Create an application here
- On the API Manager section, go to "Credentials" and create a new API key
- Enable your application to communicate the YouTube Api here
- Make sure the following URL works for you in your browser (Change the keys at the end!): https://www.googleapis.com/youtube/v3/channels?part=statistics&id=PutYourYoutubeIdHere&key=PutYourNewlyGeneratedKeyHere
The downloaded code can be included as a new library into the IDE selecting the menu:
Sketch / include Library / Add .Zip library
You also have to install the ArduinoJson library written by Benoît Blanchon. Search for it on the Arduino Library manager or get it from here.
Include YoutubeApi in your project:
#include <YoutubeApi.h>
and pass it a Bot token and a SSL Client (See the examples for more details)
#define API_KEY "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
// WiFiSSLClient client; //For 101 boards
WiFiClientSecure client; //For ESP8266 boards
YoutubeApi bot(API_KEY, client);
NOTE: This library has not been tested with the 101 boards as I do not have a compatible board. If you can help please let me know!