47

So previously i was getting a youtube channel subscriber count with youtube data api v2.

I used the following (I am using TED channel for demo purposes)

http://gdata.youtube.com/feeds/api/users/TEDtalksDirector?alt=json&callback=jQuery111202977260369807482_1433828589506&jsonp&_=1433828589507

However with the new v3 api, there is no subscriber count in the result.

https://www.googleapis.com/youtube/v3/subscriptions?part=snippet%2CcontentDetails&channelId=UCAuUUnT6oDeKwE6v1NGQxug&key=fhjfshdjfhsjdhfjshdjfhsjdfhsjdhfjshdjfhsjdhs

Is there a way in which I can get the subscriber count value?

elena
  • 3,740
  • 5
  • 27
  • 38
kianmeng
  • 507
  • 1
  • 4
  • 7
  • answer with both "get_content" an cURL here : http://stackoverflow.com/questions/31416862/parse-youtube-subscribers-count-with-new-youtube-api-v3 – Damien Sellier Jul 15 '15 at 16:18

2 Answers2

72

Use it like this:

https://www.googleapis.com/youtube/v3/channels?part=statistics&id=channel_id&key=your_key

You can try your API request here: https://developers.google.com/youtube/v3/docs/channels/list#try-it

dikirill
  • 1,873
  • 1
  • 19
  • 21
Muhamed
  • 876
  • 8
  • 11
  • 2
    Also helpful: http://stackoverflow.com/questions/13871817/youtube-channel-subscriber-count/31038060#31038060 – Ben Jun 24 '15 at 22:15
  • 2
    Wow it took me a long time to figure out that the channel_id is not your channel name which appears in the public URL. Query for your channel in order to find it's true id: https://www.googleapis.com/youtube/v3/search?part=snippet&key=API_KEY&type=channel&q=MrBeast – Ryan Sep 13 '22 at 15:11
  • This subriber count is not in realtim – Luca Ziegler May 24 '23 at 22:09
2

One other thing to be aware of is that there is a boolean: Statistics.HiddenSubscriberCount. If set to true then SubscriberCount will be null.

An example channel is CBS New York:

https://www.youtube.com/channel/UCNZyLULUQBp5e9Q1cKtvk6Q/

I don't know why somebody would want to hide their subscriber count - usually it's a badge of honour. I'd guestimate that 7% of channels hide subscriber count, so it might really confuse you if you're testing your API calls on a channel that does!

BrettB
  • 104
  • 4