gpt4 book ai didi

youtube - YouTube API v3按 channel ID搜索不会返回该 channel 中的所有视频

转载 作者:行者123 更新时间:2023-12-03 05:23:25 24 4
gpt4 key购买 nike

观看此YouTube channel :
https://www.youtube.com/channel/UCqiwZNUf9z9OrseJoVGWMMg

它包含8个视频。但是,下面的请求仅返回5个视频(即使maxResults设置为10,也是如此)。

https://www.googleapis.com/youtube/v3/search?safeSearch=none&order=title&part=snippet&channelId=UCqiwZNUf9z9OrseJoVGWMMg&type=video&maxResults=10&key={YOUR_API_KEY}

您可以在JSON响应的第一部分中看到 totalResults仅为5,而不是预期的8。
{
"kind": "youtube#searchListResponse",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/MhPawf_XoAn1dq-tgkkE4aPpbD0\"",
"pageInfo": {
"totalResults": 5,
"resultsPerPage": 10
},
...

响应中的items数组仅包含5个项目。我已经尝试过查询的多种变体(包括关闭safeSearch),但它不会返回 channel 中的所有视频。

最佳答案

以下要求:

https://www.googleapis.com/youtube/v3/search?order=title&part=snippet&channelId=UCqiwZNUf9z9OrseJoVGWMMg&type=video&maxResults=10&key={YOUR_API_KEY}

给了我以下结果:
 {
"kind": "youtube#searchListResponse",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/8i-meJV39_yfRucbNqwGwygIReU\"",
"pageInfo": {
"totalResults": 8,
"resultsPerPage": 10
}

据我所知,这与您发布的唯一区别是相同的,我没有指定safesearch参数就尝试了它,但是正如您在返回的项目列表中所看到的那样-它为我提供了该 channel 上的所有视频。我不确定API为何会对您造成错误,但它应该给出正确的结果。希望我能有所帮助。

PS .:也尝试过使用safesearch参数。我得到了具有“严格”和“无”值的结果(5个视频),但它以“中度”值将我一直在寻找的所有8个视频都带回我,我认为默认值是“我”没有指定的参数。
 "items": [
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/DlNXovOlstICaTGq9kp43GR9eBU\"",
"id": {
"kind": "youtube#video",
"videoId": "pcorjQxfwoA"
},
"snippet": {
"publishedAt": "2015-04-08T16:59:38.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "EBB Retrofit Animation",
"description": "This animation shows what is involved in completing a seismic retrofit on a house with a raised foundation and a 4 foot cripple wall.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/pcorjQxfwoA/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/pcorjQxfwoA/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/pcorjQxfwoA/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/0KLoeBTh2PYOW5CwXmq4Yzxhc-8\"",
"id": {
"kind": "youtube#video",
"videoId": "RV1IzHmSojI"
},
"snippet": {
"publishedAt": "2015-04-08T17:00:17.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "EBB Retrofit HD",
"description": "Watch Earthquake Brace + Bolt in action.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/RV1IzHmSojI/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/RV1IzHmSojI/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/RV1IzHmSojI/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/x74SevHlVYKeMKmn3O9Toaa33Lg\"",
"id": {
"kind": "youtube#video",
"videoId": "stpSa2rIbS8"
},
"snippet": {
"publishedAt": "2015-04-08T17:33:29.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "FEMA Training Part 2",
"description": "This video introduces the effect of earthquakes on houses, discusses past performance of houses in earthquakes, and introduces partial seismic rehabilitation...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/stpSa2rIbS8/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/stpSa2rIbS8/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/stpSa2rIbS8/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/7sTYIalNOCQ6jn9X4VBCMphFzbk\"",
"id": {
"kind": "youtube#video",
"videoId": "jYll7dENSOo"
},
"snippet": {
"publishedAt": "2015-04-08T17:23:02.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "FEMA Training Part 6",
"description": "This video provides a brief overview of important concepts for identifying the load path in a structure, construction of shear walls, and correctly installin...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/jYll7dENSOo/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/jYll7dENSOo/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/jYll7dENSOo/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/GyHVsiWjC3smdvRyhqM7k9TSAL4\"",
"id": {
"kind": "youtube#video",
"videoId": "KHNx0SluNBA"
},
"snippet": {
"publishedAt": "2015-04-08T17:16:18.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "FEMA Training Part 4",
"description": "This video clarifies that seismic rehabilitation work falls under the purview of the building code and building department, and gives a brief overview of code ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/KHNx0SluNBA/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/KHNx0SluNBA/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/KHNx0SluNBA/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/qJoVONxqCG32ExIyXSOYwxgT4Q4\"",
"id": {
"kind": "youtube#video",
"videoId": "iaS1wIIrXbA"
},
"snippet": {
"publishedAt": "2015-04-08T17:07:42.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "FEMA Training Part 1",
"description": "This video introduces the training course, defines applicable terminology, and shows pictorially why seismic rehabilitation of houses is important.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/iaS1wIIrXbA/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/iaS1wIIrXbA/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/iaS1wIIrXbA/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/Ps3HC7X95sTlZ-sR3ZP3lHYhQSM\"",
"id": {
"kind": "youtube#video",
"videoId": "0hQpBJJofcs"
},
"snippet": {
"publishedAt": "2015-04-08T17:31:56.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "FEMA Training Part 5",
"description": "This video addresses application of prescriptive provisions for anchorage to foundation and cripple wall bracing contained in the International Existing Building ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/0hQpBJJofcs/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/0hQpBJJofcs/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/0hQpBJJofcs/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"Y3xTLFF3RLtHXX85JBgzzgp2Enw/F1VbW4J8TYbRDZuDeotUfWoBi9M\"",
"id": {
"kind": "youtube#video",
"videoId": "OLclXnCQD2k"
},
"snippet": {
"publishedAt": "2015-04-08T17:12:49.000Z",
"channelId": "UCqiwZNUf9z9OrseJoVGWMMg",
"title": "FEMA Training Part 3",
"description": "This video is the heart of the training course, introducing seismic vulnerabilities 'A through K' discussing how to identify vulnerable conditions, likely ea...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/OLclXnCQD2k/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/OLclXnCQD2k/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/OLclXnCQD2k/hqdefault.jpg"
}
},
"channelTitle": "",
"liveBroadcastContent": "none"
}
}
]
}

关于youtube - YouTube API v3按 channel ID搜索不会返回该 channel 中的所有视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31035347/

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