gpt4 book ai didi

json - YouTube API |没有得到完整的JSON响应

转载 作者:行者123 更新时间:2023-12-03 05:56:43 30 4
gpt4 key购买 nike

通过oAuth访问YouTube API时,我会正常处理请求。但是,当我尝试从api中提取GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}时,这是部分响应。 api资源管理器的“尝试”部分表明,我有类似以下内容:

{
"kind": "youtube#channelListResponse",
"etag": "\"CuSCwMPVmgi8taDtE2LV6HdgkN0/fPSUUr0h7J55AKwqUPO1XTzosJo\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{

"kind": "youtube#channel",
"etag": "\"CuSCwMPVmgi8taDtE2LV6HdgkN0/SKfAkvqva5DXzL8H0X-h8n5TACg\"",
"id": "UCn1kMRRSG8-QdRWcaK7BgIw",
"contentDetails": {
"relatedPlaylists": {
"likes": "LLn1kMRRSG8-QdRWcaK7BgIw",
"favorites": "FLn1kMRRSG8-QdRWcaK7BgIw",
"uploads": "UUn1kMRRSG8-QdRWcaK7BgIw",
"watchHistory": "HLn1kMRRSG8-QdRWcaK7BgIw",
"watchLater": "WLn1kMRRSG8-QdRWcaK7BgIw"
},
"googlePlusUserId": "101052779404071735515"
}
}
]
}

但是,我通常只会得到这个:
{
"kind": "youtube#channelListResponse",
"etag": "\"CuSCwMPVmgi8taDtE2LV6HdgkN0/fPSUUr0h7J55AKwqUPO1XTzosJo\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"CuSCwMPVmgi8taDtE2LV6HdgkN0/SKfAkvqva5DXzL8H0X-h8n5TACg\"",
"id": "UCn1kMRRSG8-QdRWcaK7BgIw",
}
]
}

最佳答案

您的HTTP示例请求GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}通常用于检索 channel 信息。该请求使用channels.list方法来检索关于属于autht_a中讨论的属于已认证用户的 channel 的详细信息。

此外,文档指出:

The response to this request includes the channel ID and contentDetails for the authenticated user's channel. The contentDetails include the several system-generated playlists associated with the channel. Many of the subsequent requests require either the channel ID or one of the playlist IDs, so it's important to record them.



您收到的响应不能视为部分响应,因为 Retrieve Channel Information指出:

To request a partial API response, add the fields parameter to the URL that you would use to retrieve the full API response,

关于json - YouTube API |没有得到完整的JSON响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36853721/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com