Coder Social home page Coder Social logo

danielsebesta / youtube-subscribers Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3 KB

๐ŸŽฌ Youtube Subscriber Count using API

License: The Unlicense

PHP 100.00%
php youtube api youtube-api youtube-api-v3 subscriber-count subscribers sociablade-api subscriber-api subscribers-api

youtube-subscribers's Introduction

porfolio-home-desktop-second-home-variant (4)








Total Time: 40 mins

Other                   โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“   100.00 %

Latest posts from dev.to

youtube-subscribers's People

Contributors

danielsebesta avatar

Stargazers

 avatar

Watchers

 avatar

youtube-subscribers's Issues

Youtube Subscribers, Total Views, Total Likes and Total Dislikes Counter

Can we pull other data besides the youtube subscriber counter?

For example:

Subscribers:
Total Video:
Total Views:
Total Likes:
Total Dislikes:
Total Comment:

Thanks for this.

I did some research, tried something based on some examples but some of them are not working.

Source: https://stackoverflow.com/questions/25826571/get-comment-or-likes-count-for-youtube-video-using-api-3-0

<?php

// PHP - SUBSCRIBER COUNT USING YOUTUBE API V3
// BY @danielsebesta

// Google Developers: https://console.developers.google.com/apis/?pli=1
// Youtube Channel ID: https://www.youtube.com/account_advanced

$api_key = "AIzaSyBc-UkCwebflDh1pi0rNL7QTP-1Skf8TnU";
$channel_id = "UCfUwyi5dAZ3DuXI8GP9vhUg";

$api_response = file_get_contents('https://www.googleapis.com/youtube/v3/channels?part=statistics&id=' . $channel_id . '&key=' . $api_key . '');

$api_response_decoded = json_decode($api_response, true);

// Subscribers
$subscribers = $api_response_decoded['items'][0]['statistics']['subscriberCount'];

// Videos
$videos = $api_response_decoded['items'][0]['statistics']['videoCount'];

// Views
$views = $api_response_decoded['items'][0]['statistics']['viewCount'];

// Likes
$likes = $api_response_decoded['items'][0]['statistics']['likeCount'];

// Dislikes
$dislikes = $api_response_decoded['items'][0]['statistics']['dislikeCount'];

// Dislikes
$comments = $api_response_decoded['items'][0]['statistics']['commentCount'];


echo $subscribers;
echo "</br></br>";
echo $views;
echo "</br></br>";
echo $likes;
echo "</br></br>";
echo $dislikes;
echo "</br></br>";
echo $comments;
echo "</br></br>";
echo $videos;

?>


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.