某些视频未显示在 API 结果中



我注意到帐户中的所有视频,Kanye West - Topic,都没有显示在api结果中。有没有人有理由或解决方案来解决这个问题?例如,当我使用 api 搜索GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCRY5dYsbIN5TylSbd7gVnZg&type=video&key={YOUR_API_KEY} 时,它说总共有 961 个结果,但项目部分为空。

您的 GET 请求是正确的,但它缺少其他字段资源参数,因此它不知道您要检索的内容。我已经使用Google API Explorer将这些字段添加到您的GET REQUEST中,如下所示:

https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCRY5dYsbIN5TylSbd7gVnZg&maxResults=50&q=%22Kanye+West%22&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CprevPageToken%2CregionCode%2CtokenPagination%2CvisitorId&key={API_KEY_HERE}

得到的回应是:

{
 "kind": "youtube#searchListResponse",
 "etag": ""GM4ZnRh2gk1X1BLWgHklTm-3cgQ/6VdmXA4FhXjg08y58iRnmXZY7wQ"",
 "nextPageToken": "CDIQAA",
 "regionCode": "PH",
 "pageInfo": {
  "totalResults": 841,
  "resultsPerPage": 50
 },
 "items": [
  {
   "kind": "youtube#searchResult",
   "etag": ""GM4ZnRh2gk1X1BLWgHklTm-3cgQ/VSzDMW_CqJw-OMjo_vzPR2P40eI"",
   "id": {
    "kind": "youtube#channel",
    "channelId": "UCRY5dYsbIN5TylSbd7gVnZg"
   },
   "snippet": {
    "publishedAt": "2013-07-02T20:09:18.000Z",
    "channelId": "UCRY5dYsbIN5TylSbd7gVnZg",
    "title": "Kanye West - Topic",
    "description": "Kanye Omari West is an American rapper, songwriter, record producer, fashion designer, and entrepreneur. Born in Atlanta and raised in Chicago, West first ...",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/i/RY5dYsbIN5TylSbd7gVnZg/1.jpg"
     },
     "medium": {
      "url": "https://i.ytimg.com/i/RY5dYsbIN5TylSbd7gVnZg/mq1.jpg"
     },
     "high": {
      "url": "https://i.ytimg.com/i/RY5dYsbIN5TylSbd7gVnZg/hq1.jpg"
     }
    },
    "channelTitle": "Kanye West - Topic",
    "liveBroadcastContent": "none"
   }
   .. (long list below)

如果您想进行附加测试,请使用 Youtube API 资源管理器。

相关内容

  • 没有找到相关文章

最新更新