YouTube Channel Subscription for Android

I am using the YouTube API in my application. Users can log in to their Google+ account. I want the user to be able to subscribe to certain YouTube channels.

There seems to be something for the web here: https://developers.google.com/youtube/subscribe/

But I can not find something suitable for Android. Am I missing something from the documentation or is there a workaround?

+4
source share
1 answer

You do not need a special Android library to subscribe an authenticated user to a specific channel. Just send an authenticated POST request to the endpoint subscriptions/insertusing the channelIdchannel you want to subscribe to with the parameter Part snippet:

HTTP POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}

Request body:

{
    "snippet": {
        "resourceId": {
            "channelId": "XXXXX" // channel ID you want to subscribe to
        }
    }
}
+1
source

Source: https://habr.com/ru/post/1625244/


All Articles