Free YouTube Stats Badge
This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) without YouTube API
Motive of this project
There is no way to get YouTube Stats (Subscriber Count, Videos Count, Views Count) without using YouTube API, that's why there is no public img.shield.io
badge which will count Live YouTube Stats for you.
That's why, I've created this project, which will help you to create Live YouTube Stats Badges for absolutely Free, which you can then use on your GitHub page.
Example Badges
Urls
Name | Example |
---|---|
Live Subscriber count | |
Live Total Views count | |
Live Total Videos count |
Styles
Name | Examples |
---|---|
plastic | |
flat | |
flat-square | |
for-the-badge | |
social |
Features
- Caching Functionality to Prevent Rate Limiting
- Using Free API for fetching LIVE YouTube Stats
- Converts Integer (e.g. 10700) to K-Thousand, M-Million, B-Billion, T-Trillion Number (e.g. 10.7K)
- Very Low Latency as Whole Project is Written in GoLang
Commands For Local Testing
- How to use on Windows Server for testing purposes
# Export Cache Time Global Variable
SET CACHE_TIME=10
# Export CHANNEL_ID Global Variable containing your YouTube Channel ID
SET CHANNEL_ID=UCRv-wp0CWXXXXXX3NkTIXXX
# Running API
go run .
# Visit: http://localhost:8090/subscribers
- How to use on Linux Server for testing purposes
# Export Cache Time Global Variable
export CACHE_TIME=10
# Export CHANNEL_ID Global Variable containing your YouTube Channel ID
export CHANNEL_ID=UCRv-wp0CWXXXXXX3NkTIXXX
# Running API
go run .
# Visit: http://localhost:8090/subscribers
Deployment
It is neccessary to deploy this repo by yourself to get a domain for the desired youtube channel. An easy and free way to deploy this repo is by using vercel. Just use the button below.
Step by step
-
Click on the above deploy button or simply click here
-
Click on GitHub Button
-
Click on Add GitHub Namespace and Authorize vercel
-
After Adding the GitHub Namespace, Select your Namespace from the Drop down
-
Type Any Repository Name of your choice & then click on Create Button
-
Type your Channel ID and Cache Time, then finally click on Deploy Button
Usage
-
Deploy the repo and get your url from domains
Example in vercel:
-
Visit this url: Shields.io and scroll down
-
Add your vercel url to the url field
-
Add your wanted url suffix:
- to get the subscriber count: add api/subscriber
- to get the view count: add api/views
- to get the video count: add api/videos
It should look like this:
-
Override the labels/colors/logo if you want (optional)
-
Click on the button to copy the badge url