DKARDU
Published © LGPL

How to Make REAL TIME YouTube Subscriber Counter

Hi friends, today this video will show you the most common 3 ways to get your Youtube channel subscribes and views.

BeginnerFull instructions provided30 minutes2,669

Things used in this project

Hardware components

NodeMCU ESP8266
×1
1602 / 2004 LCD IIC I2C
×1
MAX7219
×1
Breadboard
×1
Jumper wires
×1
Arduino Nano R3
Arduino Nano R3
×1

Story

Read more

Schematics

subscribe_counter_2004_tH02DQXPin.jpg

Code

Subscribe_Counter_2004.ino

Arduino
#include <YoutubeApi.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

char ssid[] = "123214"; // Wifiname
char password[] = "123124"; // Wifipassword
#define API_KEY "123124214"  // YoutubeApi:https://console.developers.google.com/apis/dashboard
#define CHANNEL_ID "12312341241" // Youtube Channel ID

int nextStatDelay = 100; 

// NodeMCU Dev Kit => D1 = SCL, D2 = SDA 
LiquidCrystal_I2C lcd(0x27, 20, 4);

WiFiClientSecure client;
YoutubeApi api(API_KEY, client);

unsigned long api_mtbs = 60000; 
unsigned long api_lasttime;

long subs = 0;

void setup() {
  
  Serial.begin(115200); 
  Serial.println();
  lcd.begin();
  lcd.backlight();
  lcd.clear();

  WiFi.begin(ssid, password);
  Serial.print("connecting");
  lcd.print("connecting");

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    lcd.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected: ");
  Serial.println(WiFi.localIP());
  lcd.clear();
  lcd.setCursor(2, 0);
  lcd.print(WiFi.localIP());
  lcd.setCursor(2, 1);
  lcd.print("wait for data");
  Serial.print("wait for data");
}

void loop() {
  if (millis() - api_lasttime > api_mtbs)  {
    if (api.getChannelStatistics(CHANNEL_ID))
    {
      lcd.clear();
      Serial.println(api.channelStats.subscriberCount);
    lcd.setCursor(6, 1); 
      lcd.print("SUBSCIBER"); 
      lcd.setCursor(10, 2); 
      lcd.print(api.channelStats.subscriberCount);
      delay(20000); 
      delay(nextStatDelay);
      lcd.clear();
      Serial.println(api.channelStats.viewCount);
      lcd.setCursor(8, 1); 
      lcd.print("VIEW "); 
      lcd.setCursor(9, 2); 
      lcd.print(api.channelStats.viewCount);
      delay(10000); 
    }
    delay(nextStatDelay);
  }

}

Credits

DKARDU
22 projects • 44 followers
Arduino
Contact

Comments

Please log in or sign up to comment.