DenverCoder1 / github-readme-youtube-stats

Youtube stats badges for your Github profile README. Displays the total number of subscribers or the view count for your channel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Github README YouTube Stats

Youtube stats badges for your Github profile README

youtube subscribers youtube views

Archived

This project is now archived since the YouTube API is now officially supported by Shields.io

Table of Contents

Subscribers badge

youtube subscribers

Quick set up:

Use this URL to get the number of subscribers for your channel as shown above

https://github-readme-youtube-stats.herokuapp.com/subscribers/index.php?id=[YOUR CHANNEL ID]&key=[YOUR API KEY]

Markup for creating the badge as a link to your YouTube channel

<a href="https://www.youtube.com/channel/[YOUR CHANNEL ID]">
 <img alt="youtube subscribers" src="https://github-readme-youtube-stats.herokuapp.com/subscribers/index.php?id=[YOUR CHANNEL ID]&key=[YOUR API KEY]"/>
</a>

See below for info on how to get a YouTube API key and your channel's ID.

View count badge

youtube views

Quick set up:

https://github-readme-youtube-stats.herokuapp.com/views/index.php?id=[YOUR CHANNEL ID]&key=[YOUR API KEY]

Markup for creating the badge as a link to your YouTube channel

<a href="https://www.youtube.com/channel/[YOUR CHANNEL ID]">
 <img alt="youtube views" src="https://github-readme-youtube-stats.herokuapp.com/views/index.php?id=[YOUR CHANNEL ID]&key=[YOUR API KEY]"/>
</a>

See below for info on how to get a YouTube API key and your channel's ID.

Additional parameters

color

Color of the right side of the badge (css named color or hex digits)

Default: blue for subscribers, brightgreen for views

Parameter Appearance
?color=red youtube subscribers
?color=0a8b9d youtube views

logo

Company logo supported by shields.io

Default: youtube

Parameter Appearance
?logo=none youtube subscribers
?logo=plex youtube views

logoColor

Color of the logo

Default: white

Parameter Appearance
?logoColor=gold youtube subscribers
?logoColor=brightgreen youtube views

style

Style of the badge

Default: flat-square

Parameter Appearance
?style=plastic youtube subscribers
?style=flat youtube subscribers
?style=flat-square youtube subscribers
?style=for-the-badge youtube subscribers
?style=social youtube subscribers

label

Label for the badge

Default: Youtube subscribers for subscribers, YouTube view count for views

Parameter Appearance
?label=Subscribe youtube subscribers
?label=View+count youtube views

labelColor

Color for the left part of the badge

Default: gray

Parameter Appearance
?labelColor=magenta youtube subscribers
?labelColor=33ab06 youtube views

format

Display format of the number in the badge

Default: short

Parameter Appearance
?format=none youtube views
?format=commas youtube views
?format=short youtube views

Mixing styles

Parameter Appearance
?style=social&logoColor=black&label=Subscribe youtube subscribers
?label=View+count&style=for-the-badge&color=3d3d3d&format=commas youtube views
?label=Views&style=for-the-badge&color=red&labelColor=ce4630 youtube views

See shields.io for more info on parameters

How to get a Youtube API key

  1. Go to https://console.developers.google.com/project and sign in
  2. Click "Create Project"
  3. Name your project and click "Create"
  4. Click the "Google APIs" link in the top left corner and select your project
  5. Click "Enable APIs and Services"
  6. Search for "YouTube Data API"
  7. Enable "YouTube Data API v3"
  8. In the left panel select "Credentials"
  9. Click "Create Credentials", then "API key"
  10. Copy your API key

How to find your YouTube channel ID

  1. Make sure you are signed into your YouTube channel
  2. Go to https://www.youtube.com/account_advanced
  3. You will find your channel ID below your user ID
  4. Click "Copy" to copy your channel ID

channel_id

Finding a channel ID when not signed in

  1. Go to the channel page for the user you want the ID of
  2. Press Ctrl+U to open the source code of the page
  3. Press Ctrl+F on the source code and search for itemprop="channelId"
  4. In the meta tag, the content attribute will have the channel ID.

method2

Deploying it on your own

If you can, it is preferable to host the files on your own server.

Doing this can lead to better uptime and more control over customization (you can modify the code for your usage).

Also, deploying it on your own means you can place your API key directly into the PHP code so it will not be visible in the URL. This makes it so that your API key cannot get used by other people without your knowledge.

You can deploy the PHP files on any website server with PHP installed or as a Heroku app.

Contact me

Twitter

Support

💙 If you like this project, give it a ⭐ and share it with friends!

Youtube Patreon

☕ Buy me a coffee

Made with ❤️ and PHP

Powered by Heroku

About

Youtube stats badges for your Github profile README. Displays the total number of subscribers or the view count for your channel.

License:MIT License


Languages

Language:PHP 86.9%Language:HTML 7.0%Language:CSS 6.1%