是否可以通过一次查询搜索多个频道?

Is it possible to search multiple channels with one query?

我想通过 Channels.id 参数在多个频道中通过一次查询搜索视频。 例如:

我的请求URL是:https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=UCSzAsgKDpNkch1eRA9w5nww%20%2B%20UCyCBf6asf89aQJaSXuAuTsg&q=Bitcoin&type=video&key=[YOUR_API_KEY]

答案是:

{
  "kind": "youtube#searchListResponse",
  "etag": "DCv8u79rz_Z5yPVlSxf2awnPWTQ",
  "regionCode": "DE",
  "pageInfo": {.
    "totalResults": 0,
    "resultsPerPage": 0
  },
  }, "items": []
}

2022 年的 YouTube 搜索 API V3 无法通过一个请求搜索多个 Channel.id 的主题吗?

我已经尝试了几种组合运算符。 我做错了什么吗?

不,您尝试的方式是不可能的 - 当使用多个通道时(或 field/parameter 中的多个值 ),值是comma-separated,但是,即使对请求进行了此修复,API 也没有带来任何结果。

See demo

相反,您应该为每个频道发出一个请求。

使用 channelId 搜索 UCSzAsgKDpNkch1eRA9w5nww - 参见 demo # 1

使用 channelId 搜索 UCyCBf6asf89aQJaSXuAuTsg - 参见 demo # 2


相反,如果您想搜索符合您条件的渠道(德国地区的比特币),请参阅此 sample

结果(汇总):

{
  "kind": "youtube#searchListResponse",
  "etag": "MF1reS3I3oQvjOtYP2oZ8FI9sJ8",
  "nextPageToken": "CAUQAA",
  "regionCode": "DE",
  "pageInfo": {
    "totalResults": 19344,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#searchResult",
      "etag": "pBsNFEU4k7Fc5rWvL9z8woS_0ew",
      "id": {
        "kind": "youtube#channel",
        "channelId": "UCwdYYyyX9V3u_b6URNpBh_w"
      },
      "snippet": {
        "publishedAt": "2020-05-24T15:48:35Z",
        "channelId": "UCwdYYyyX9V3u_b6URNpBh_w",
        "title": "Bitcoin verstehen",
        "description": "Was ist Bitcoin und wieso benötigen wir ihn? In diesem Podcast bringen wir neugierigen Einsteigern und auch Fortgeschrittenen ...",
        "thumbnails": {
          "default": {
            "url": "https://yt3.ggpht.com/nz1XMTZCai2Op7clT386e3l9vFBb2eYKOexx8udRqDbmwDqkR10els3i-RYeH7ukSSoGWtSDp8A=s88-c-k-c0xffffffff-no-rj-mo"
          },
          "medium": {
            "url": "https://yt3.ggpht.com/nz1XMTZCai2Op7clT386e3l9vFBb2eYKOexx8udRqDbmwDqkR10els3i-RYeH7ukSSoGWtSDp8A=s240-c-k-c0xffffffff-no-rj-mo"
          },
          "high": {
            "url": "https://yt3.ggpht.com/nz1XMTZCai2Op7clT386e3l9vFBb2eYKOexx8udRqDbmwDqkR10els3i-RYeH7ukSSoGWtSDp8A=s800-c-k-c0xffffffff-no-rj-mo"
          }
        },
        "channelTitle": "Bitcoin verstehen",
        "liveBroadcastContent": "none",
        "publishTime": "2020-05-24T15:48:35Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "j2amjttw_gCECoVnlJEB4Y5g41E",
      "id": {
        "kind": "youtube#channel",
        "channelId": "UC61jC9ggxeGu8HJ9Q_TxOGg"
      },
      "snippet": {
        "publishedAt": "2013-09-06T02:12:33Z",
        "channelId": "UC61jC9ggxeGu8HJ9Q_TxOGg",
        "title": "BITCOIN",
        "description": "YouTube.com/c/BITC0IN https://Odysee.com/@BITCOIN:d77 https://Twitter.com/BITC0INALLCAPS https://zbd.gg/BITC0IN - Tip ...",
        "thumbnails": {
          "default": {
            "url": "https://yt3.ggpht.com/WG8_95AszbGpSw8w2Qx1VWq_1Ko6-VIvfezMG_YRi330HpZMWQaroK1wMf--zBXKddg4TW2Wvg=s88-c-k-c0xffffffff-no-rj-mo"
          },
          "medium": {
            "url": "https://yt3.ggpht.com/WG8_95AszbGpSw8w2Qx1VWq_1Ko6-VIvfezMG_YRi330HpZMWQaroK1wMf--zBXKddg4TW2Wvg=s240-c-k-c0xffffffff-no-rj-mo"
          },
          "high": {
            "url": "https://yt3.ggpht.com/WG8_95AszbGpSw8w2Qx1VWq_1Ko6-VIvfezMG_YRi330HpZMWQaroK1wMf--zBXKddg4TW2Wvg=s800-c-k-c0xffffffff-no-rj-mo"
          }
        },
        "channelTitle": "BITCOIN",
        "liveBroadcastContent": "upcoming",
        "publishTime": "2013-09-06T02:12:33Z"
      }
    },
    [...]
  ]
}