0

I'm in need of accessing the number of subscribers a youtube channel that is associated with the current logged in user has. Online documentation for this seems confusing. I want to prompt user to accept permission requests for viewing their youtube account then I want to retrieve the subscriber count. The latter seems easy but the first part I can't figure out. I'm not sure if I need to retrieve a list of channels from their Google+ profile then get access the details of these channels via youtube data api. or is there a direct way of doing it simply via youtube api where I can prompt a screen to the user so they can select the channel/account they want to go with. Any help is appreciated.

Omer Ozer
  • 455
  • 1
  • 8
  • 20

1 Answers1

0

I haven't seen any implementation where you get a Youtube channel_id straight from Google+. To prove this I made a REST call using Google+ Try-it. Checking the response, there was no mention of Youtube channels. This will have to be done using Youtube API.

"I want to retrieve the subscriber count..is there a direct way of doing it simply via youtube api .."

Make a 'GET' REST call, you will see the number of subscribers of the channel :

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

(try this in the browser)

To make REST calls in JAVA, try to:

  1. Use Retrofit, a type-safe HTTP client for Android and Java.
  2. Follow steps in this SO thread which uses Asynchronous Http Client.
Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56