Youtube API用于检索用户列表

时间:2014-09-10 07:22:30

标签: youtube youtube-api youtube-javascript-api youtube-data-api

YouTube API是否允许按Facebook或Twitter等关键字检索用户列表或搜索用户?

我已经查看了各种链接,但对此没有任何好运。我也没有在API中获得任何参考。

它允许我们检索单个用户个人资料,但不能检索用户或搜索用户列表。

https://developers.google.com/youtube/2.0/developers_guide_protocol_profiles

1 个答案:

答案 0 :(得分:0)

如果您想搜索,则需要将YouTube API V3youtube.search.list

一起使用

参数:

part=snippet
q=specifies the query term to search

例如:

part=snippet
q=John McClane

有很多参数,你可以列出 here

结果如下:

{
    "kind": "youtube#searchListResponse",
    "etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/teWJW4A0TwwN7Uj9j0tWqhVp4_s\"",
    "nextPageToken": "CAUQAA",
    "pageInfo": {
    "totalResults": 24818,
    "resultsPerPage": 5
    },
    "items": [
    {
        "kind": "youtube#searchResult",
        "etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/OjVFl2pvXFz_mZGwtMxD0HA-5Ik\"",
        "id": {
        "kind": "youtube#video",
        "videoId": "UJaHzHwTTZs"
    },
        "snippet": {
        "publishedAt": "2008-03-13T18:41:32.000Z",
        "channelId": "UCRTNthXNmXi_io0vvTwy9MQ",
        "title": "Die Hard Killathon!",
        "description": "After John Matrix and John Rambo, it's the turn of John McClane! Let's see how he fares in the battle of the movie maniacs - how many people does McClane kil.",
        "thumbnails": {
        "default": {
        "url": "https://i.ytimg.com/vi/UJaHzHwTTZs/default.jpg"
    },
        "medium": {
        "url": "https://i.ytimg.com/vi/UJaHzHwTTZs/mqdefault.jpg"
    },
        "high": {
        "url": "https://i.ytimg.com/vi/UJaHzHwTTZs/hqdefault.jpg"
    }
    },
        "channelTitle": "payndz",
        "liveBroadcastContent": "none"
    }
},

有一个live demo

编辑10-09-2014

您需要在自己的代码中解析YouTube API search list的结果。

  1. 获取youtube api的结果
  2. 使用正则表达式搜索channelTitle" abc"例如在结果输出中
  3. 你有结果!