Android 版 YouTube 频道订阅 [英] YouTube channel subscribe for Android
问题描述
我在我的应用中使用 YouTube API.用户可以使用他们的 Google+ 帐户登录.我希望用户能够订阅某些 YouTube 频道.
I am using the YouTube API within my app. Users can log in with their Google+ account. I would like the user to be able to subscribe to certain YouTube channels.
这里似乎有一些网络内容:https://developers.google.com/youtube/订阅/
There seems to be something for web here: https://developers.google.com/youtube/subscribe/
但我找不到适合 Android 的东西.我是否遗漏了文档中的某些内容或是否有解决方法?
But I can't find something suited to Android. Am I missing something from the documentation or is there a workaround?
推荐答案
您不需要特定的 Android 库来为经过身份验证的用户订阅特定频道.只需将经过身份验证的 POST 请求发送到 subscriptions/insert
端点,带有您要订阅的频道的 channelId
,带有 Part
参数 snippet
:
You don't need a specific Android library to subscribe an authenticated user to a specific channel. Just send an authenticated POST request to the subscriptions/insert
endpoint with the channelId
of the channel you want to subscribe to with the Part
param snippet
:
HTTP POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}
请求正文:
{
"snippet": {
"resourceId": {
"channelId": "XXXXX" // channel ID you want to subscribe to
}
}
}
这篇关于Android 版 YouTube 频道订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!