首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Youtube API播放列表不返回播放列表

Youtube API播放列表不返回播放列表
EN

Stack Overflow用户
提问于 2021-11-08 12:50:09
回答 1查看 459关注 0票数 0

我正在使用Youtube的API的播放列表端点从特定的频道获取播放列表,但它不适用于以下通道:

https://www.youtube.com/channel/UCX5fyLRcU05DMa2OVu-qFEQ

https://www.youtube.com/channel/UCwm2mdiUXApmL5bCxHtgJIA

我使用的查询:

代码语言:javascript
复制
https://www.googleapis.com/youtube/v3/playlists?channelId=UCwm2mdiUXApmL5bCxHtgJIA&part=snippet&order=date&maxResults=50&key=YOUR_API_KEY

https://www.googleapis.com/youtube/v3/playlists?channelId=UCX5fyLRcU05DMa2OVu-qFEQ&part=snippet&order=date&maxResults=50&key=YOUR_API_KEY

它不会返回视频时,我试图目标在这些渠道播放列表,以及使用指定的播放列表ID。我可以看到,这些频道,播放列表和视频是公开的和可搜索的。

为什么API不应该返回我缺少的这个播放列表呢?

谢谢你的帮助。

巴图

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-11 16:11:07

如果您检查所提供频道的播放列表页,您会发现在那里发布的所有播放列表实际上都不是来自频道--这些列表是由YouTube本身添加/生成的。

示例:

https://www.youtube.com/playlist?list=OLAK5uy_nvZSUlZB8qwifPgIVCoEulF4VyErdBX48

普通播放列表(属于频道)应该有ID,如下所示:

PL3tRBEVW0hiB5KKP9gs_AkW8J4dOvbdPN

通过使用YouTube数据API,您可以测试结果:

网址:https://youtube.googleapis.com/youtube/v3/playlists?part=id%2Csnippet%2Cstatus&id=OLAK5uy_nvZSUlZB8qwifPgIVCoEulF4VyErdBX48&key=[YOUR_API_KEY]

结果:

代码语言:javascript
复制
{
  "kind": "youtube#channelListResponse",
  "etag": "Yw1yJOOwI7LJ8LeYmvQ8wpyHWbU",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#channel",
      "etag": "wDhMSGEntArTZuX56hjNjytDUlU",
      "id": "UCFtEEv80fQVKkD4h1PF-Xqw",
      "snippet": {
        "title": "Microsoft",
        "description": "Innovation is a key ingredient in Microsoft’s mission: to empower every person and organization on the planet to achieve more. \n\nSubscribe to Microsoft's official YouTube channel to explore technology’s role in making the world more sustainable, inclusive, and innovative for all.\n\n",
        "customUrl": "microsoft",
        "publishedAt": "2006-02-13T05:21:44Z",
        "thumbnails": {
          "default": {
            "url": "https://yt3.ggpht.com/ytc/AKedOLRZENZBPyEEG2cd0PZXemKKyG1GMGVJXmzHhrs4=s88-c-k-c0x00ffffff-no-rj",
            "width": 88,
            "height": 88
          },
          "medium": {
            "url": "https://yt3.ggpht.com/ytc/AKedOLRZENZBPyEEG2cd0PZXemKKyG1GMGVJXmzHhrs4=s240-c-k-c0x00ffffff-no-rj",
            "width": 240,
            "height": 240
          },
          "high": {
            "url": "https://yt3.ggpht.com/ytc/AKedOLRZENZBPyEEG2cd0PZXemKKyG1GMGVJXmzHhrs4=s800-c-k-c0x00ffffff-no-rj",
            "width": 800,
            "height": 800
          }
        },
        "localized": {
          "title": "Microsoft",
          "description": "Innovation is a key ingredient in Microsoft’s mission: to empower every person and organization on the planet to achieve more. \n\nSubscribe to Microsoft's official YouTube channel to explore technology’s role in making the world more sustainable, inclusive, and innovative for all.\n\n"
        },
        "country": "US"
      },
      "contentDetails": {
        "relatedPlaylists": {
          "likes": "",
          "uploads": "UUFtEEv80fQVKkD4h1PF-Xqw"
        }
      },
      "status": {
        "privacyStatus": "public",
        "isLinked": true,
        "longUploadsStatus": "longUploadsUnspecified"
      }
    }
  ]
}

当您查询一个普通播放列表(属于该频道)时,您将得到以下结果:

网址:https://youtube.googleapis.com/youtube/v3/playlists?part=id%2Csnippet%2Cstatus&id=PL3tRBEVW0hiB5KKP9gs_AkW8J4dOvbdPN&key=[YOUR_API_KEY]

结果:

代码语言:javascript
复制
{
  "kind": "youtube#playlistListResponse",
  "etag": "OV6gnfMDH09mU3YBdHPuf5uz1Jg",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#playlist",
      "etag": "X8YVDKLXZZfHlVTh_ud0LD-IMMQ",
      "id": "PL3tRBEVW0hiB5KKP9gs_AkW8J4dOvbdPN",
      "snippet": {
        "publishedAt": "2016-05-15T15:29:30Z",
        "channelId": "UC7_YxT-KID8kRbqZo7MyscQ",
        "title": "DOOM",
        "description": "",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/pCygvprsgIk/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/pCygvprsgIk/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/pCygvprsgIk/hqdefault.jpg",
            "width": 480,
            "height": 360
          },
          "standard": {
            "url": "https://i.ytimg.com/vi/pCygvprsgIk/sddefault.jpg",
            "width": 640,
            "height": 480
          },
          "maxres": {
            "url": "https://i.ytimg.com/vi/pCygvprsgIk/maxresdefault.jpg",
            "width": 1280,
            "height": 720
          }
        },
        "channelTitle": "Markiplier",
        "localized": {
          "title": "DOOM",
          "description": ""
        }
      },
      "status": {
        "privacyStatus": "public"
      }
    }
  ]
}

检查这个答案为您提供更多细节。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69883729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档