Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get subscriber count and videos count for a given YouTube channel?

Until now I've been using this URL to retrieve subscriber count for a channel:

http://gdata.youtube.com/feeds/api/users/<channel_id>?v=2&alt=json

And this URL to get channel videos count:

https://gdata.youtube.com/feeds/api/users/<channel_id>/uploads?v=2&alt=jsonc&max-results=0

But from this day Google discontinued using it's v2 API and I can't find replacement options for this data.

like image 773
rsk82 Avatar asked Jun 02 '15 19:06

rsk82


People also ask

How do you find the exact sub count for a YouTube channel?

Sign in to YouTube Studio. In the left Menu, select Analytics. On the Overview tab, find the Realtime card. Click View live count to view your subscriber count over time.

How can you tell how many subscribers a YouTube channel has at a certain time?

Click the channel icon on the top-right; Click YouTube studio (sometimes appears as Creator Studio); Click Creator Studio Classic in the list on the bottom-right; Click Community, and from the dropdown that opens, click Subscribers.

Why can't I see subscriber count on some YouTube channels?

As part of a more significant effort to fight creator impersonation across the platform, YouTube has stopped allowing channels to hide the number of subscribers they have. Hiding subscriber counts is one of the ways spammers succeed at impersonating other channels when leaving comments.

How do you find the exact number of subs?

You can only view a complete list of your subscribers on the web version of YouTube. To do this, go to youtube.com/subscribers. You can do this from either a desktop or mobile device, but you won't find it in your YouTube app. You can see your most recent 100 subscribers in YouTube's Studio.


1 Answers

You're going to want to use the Channels/list endpoint as pass in statistics for the part parameter.

Request:

HTTP GET: GET https://www.googleapis.com/youtube/v3/channels?part=statistics&id={CHANNEL_ID}&key={YOUR_API_KEY}

Response (with id=UCt7iVnJwjBsof8IPLJHCTgQ):

{
 "kind": "youtube#channelListResponse",
 "etag": "\"dhbhlDw5j8dK10GxeV_UG6RSReM/WNxXCvycTyqTjTn9sLJ5toVjBRY\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 1
 },
 "items": [
  {

   "kind": "youtube#channel",
   "etag": "\"dhbhlDw5j8dK10GxeV_UG6RSReM/jijTuA_iWn2Kv9aRnqeAWNAcQ6I\"",
   "id": "UCt7iVnJwjBsof8IPLJHCTgQ",
   "statistics": {
    "viewCount": "796662",
    "commentCount": "20",
    "subscriberCount": "257",
    "hiddenSubscriberCount": false,
    "videoCount": "126"
   }
  }
 ]
}

You can pass in a comma-separated list of Channel IDs for the id parameter. Because I only passed in one id, the first object of the items array will have the values you need. Get the object for the subscriberCount and videoCount values in the statistics dictionary for the data you want.

like image 136
JAL Avatar answered Oct 02 '22 09:10

JAL