Introduction: YouTube Subscriber Counter With Direct Webserver Communication
There are many DIY subscriber counter videos that use the ESP32 along with the Arduino YouTubeAPI library but this uses ArduinoJson 5 and was not compatible with the latest Arduino IDE and Nano 33 IoT board. I decided to communicate with the webserver directly and obtain the subscriber count by parsing the JSON data.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Watch the Video
Since this project requires you to set up and obtain an API key along with other tasks, I would recommend you watch the video to get an understanding of how it all flows together. The video also breaks down the sketch to make it easier to understand.
Step 2: Obtain the API Key & Channel ID
The video covers this topic step-by-step but here's what we need to do:
We need to request data from the server and to do this we need to obtain an API key. We need to login to the Google cloud platform console and navigate to the APIs & services section. The dashboard gives you an overview of your account and it keeps track of all the requests along with related information. This way, Google can track and notify you if you cross any limits and so on. Head over to the credentials tab and create a new API key. Keep a note of this API key but do not share this key with anyone. Head over to the dashboard and then select the enable APIs and services option and then select the YouTube Data API v3 from the API library. Finally, select enable and that’s all we need to do here.
Links mentioned in the video:
- API Key: https://support.google.com/cloud/answer/6158862?h...
- Channel ID: https://support.google.com/youtube/answer/3250431...
- ArduinoJSON Assistant: https://arduinojson.org/v6/assistant/
- URL: https://www.googleapis.com/youtube/v3/channels?pa...
Step 3: Update the Sketch
In order for this to work, you need to add your own API key and channel ID to the sketch. Do not forget to also include your network name and password as we need to connect to an existing WiFi network to communicate with the server.
Link To Sketch:
Step 4: Connect the OLED Module & Upload the Sketch
Once you have updated the sketch, you need to upload it to the board and connect the OLED module. We only need to connect four wires and you can use the pinout as shown in the image. Give the board a few seconds to connect to the server and display the subscriber count.
Step 5: Share It With the World
Don't forget to share this with us and the world by tagging us on social media. Also, don't forget to subscribe to our channel to watch more videos and leave future build ideas while you're at it :)
Here are some relevant links in case you would like to learn more about us. Thank you for your support!
- YouTube: https://www.youtube.com/channel/UCbWiK1A5RqAugSquB...
- BnBe Website: https://www.bitsnblobs.com/
- Instagram: https://www.instagram.com/bnbe.club/
- Facebook: https://www.facebook.com/BnBe.club
- Twitter: https://twitter.com/bnbe_club