YouTube API for all register users

Viewed 36

I want to develop an android app for YouTubers. In which any YouTuber could able to see his subscribers, views, and specific video likes and views. I have read the documentation of Youtube API as I understand that this API is for public data and I can make an API for my own channel. problem is that I need an API through which anyone who uses my app could see his data just by logging in to his/her Youtube account. Is there any way to get Youtube API for this specific problem?

1 Answers

Actually I think you have misunderstood The YouTube Data api allows you to view public and private data.

To view public data you could use something called an api key.

However to access private user data you will need to be authorized by the owner of the account. To do this we use Oauth2.

There is a limited quickstart for java.

This one seems designed for android though Android I am not an android dev so really cant help with a sample.

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  // Google Accounts
  credential =
      GoogleAccountCredential.usingOAuth2(this, Collections.singleton(TasksScopes.TASKS));
  SharedPreferences settings = getPreferences(Context.MODE_PRIVATE);
  credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null));
  // Tasks client
  service =
      new com.google.api.services.tasks.Tasks.Builder(httpTransport, jsonFactory, credential)
          .setApplicationName("Google-TasksAndroidSample/1.0").build();
}
Related