3

Im trying to get all videos from YouTube auto-generated channel (AKA Topic). I let my users add a link to the YT channel and I am sending the channel ID to retrieve videos.

On regular case, when the channel is NOT auto-generate I am using this endpoint: https://www.googleapis.com/youtube/v3/channels?part=snippet&channelId={channel_id}&key={key}

This endpoint return a list of videos that posted into this channel. The problem with topic is that the list of videos return empty...

example for this following request: https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCYF2FotHeGO6cNcldrTHN1g&key={YOUR_API_KEY}

{
 "kind": "youtube#searchListResponse",
 "etag": "\"3enKTWw-I-yugKAPnlrhH5U04vQ/Zi7b6FbLUH9xd8vhDiVs3zpfKLs\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 5
 },
 "items": [
  {
   "kind": "youtube#searchResult",
   "etag": "\"3enKTWw-I-yugKAPnlrhH5U04vQ/dkWBa22byHoKTpuDJQLPs5T6ndg\"",
   "id": {
    "kind": "youtube#channel",
    "channelId": "UCYF2FotHeGO6cNcldrTHN1g"
   },
   "snippet": {
    "publishedAt": "2013-12-21T05:18:21.000Z",
    "channelId": "UCYF2FotHeGO6cNcldrTHN1g",
    "title": "Manchester United F.C. - Topic",
    "description": "Manchester United Football Club is an English football club based in Old Trafford, Greater Manchester. The club was formed as Newton Heath LYR Football ...",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/i/YF2FotHeGO6cNcldrTHN1g/1.jpg"
     },
     "medium": {
      "url": "https://i.ytimg.com/i/YF2FotHeGO6cNcldrTHN1g/mq1.jpg"
     },
     "high": {
      "url": "https://i.ytimg.com/i/YF2FotHeGO6cNcldrTHN1g/hq1.jpg"
     }
    },
    "channelTitle": "",
    "liveBroadcastContent": "none"
   }
  }
 ]
}

Any idea how to get Topic videos?

Thanks

4

2 回答 2

0

我有类似这个问题的工作。

我的目标频道是“直播”频道(https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig

我现在所做的是使用以下 v3 API https://www.googleapis.com/youtube/v3/channelSections?part=snippet%2C+contentDetails&channelId=UC4R8DWoMoI7CAwX8_LjQHig&hl=zh-TW&key= {YOUR_API_KEY}

我们可以得到许多项目,其中部分为“contentDetails”

"contentDetails": {
  "playlists": [
   "PLU12uITxBEPEEIlLMEWFXvAeoZl0cSrok"
  ]
}

然后我们可以请求“PlaylistItems”API 来获取每个播放列表的视频。

它与正常渠道一起使用以获取其主页信息。然而,对于“直播”频道,它确实返回了一些东西,但与浏览器(Chrome)的结果不同。

我想知道是否有更好的为 YouTube 自动生成的频道解析视频的解决方案。

于 2017-12-21T08:56:22.160 回答
0

自动生成的频道没有视频。他们只有来自其他频道的视频的播放列表。所以你必须寻找播放列表。

于 2017-06-07T15:05:55.377 回答