下面我有一个简单的请求,它检索特定视频的contentDetails。
var youTubeService = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = "your-apikey",
ApplicationName = "DIGITAL.CLI"
});
var channelsListRequest = new VideosResource.ListRequest(youTubeService, "contentDetails");
channelsListRequest.Id = "FakBv-xNTeU";
var response = channelsListRequest.Execute();
Console.WriteLine(JsonConvert.SerializeObject(response));在响应中,我得到了视频被阻塞的区域列表,但是响应中也有一个名为countryRestrictions的区域。
{
"etag": "8Dlzw_juiiGAkJUxdgfegatGe34",
"items": [
{
"contentDetails": {
"caption": "false",
"contentRating": {},
"definition": "hd",
"dimension": "2d",
"duration": "PT1M37S",
"licensedContent": true,
"projection": "rectangular",
"regionRestriction": {
"blocked": [
"US",
"FM",
"MP",
"VI",
"GU",
"MH",
"PR",
"PW",
"AS",
"UM"
]
}
},
"etag": "-DZJdN2PuXnNfuceW0s7RVa4Y9I",
"id": "FakBv-xNTeU",
"kind": "youtube#video"
}
],
"kind": "youtube#videoListResponse",
"pageInfo": {
"resultsPerPage": 1,
"totalResults": 1
}}所以这个视频有regionRestrictions,但没有国家限制。countryRestrictions还在使用吗?VideoConntentDetails的客户端库文档对它们都有相同的描述。
作为一个额外的问题,如果allowed列表包含项目,那么这是否意味着所有不被允许的国家都被封锁了?
发布于 2020-12-21 14:07:10
根据VideoContentDetailsRegionRestriction的客户端库文档,不推荐这个模型类;因此也不推荐客户机库属性regionRestriction。
客户端库正在从YouTube Data的属性contentDetails.regionRestriction映射其属性contentDetails.regionRestriction。
根据YouTube Data的Videos resource的官方规范,这种API资源不包含属性countryRestriction。
你的第二个问题的答案是:是的,所有不在允许名单上的国家都被封锁(下面的重点是我的):
(名单)
识别视频可查看国家的区域代码列表。如果存在此属性,且未按其值列出国家,则该视频将被禁止在该国家出现。如果该属性存在并包含空列表,则视频将在所有国家被阻塞。。
https://stackoverflow.com/questions/65393483
复制相似问题