当前位置: 首页 > 知识库问答 >
问题:

检索“虚荣”频道的Youtube频道信息

夏侯瑞
2023-03-14

给定频道的“虚荣url”(例如youtube.com/wheelockcollege,指向youtube.com/wheelockmarketing1),是否有办法检索频道详细信息?

我使用的是API的新版本3,以及最新的Python包。

共有1个答案

艾令秋
2023-03-14

可能会先使用搜索:

GET https://www.googleapis.com/youtube/v3/search?part=snippet&q=wheelockcollege&type=channel&key={YOUR_API_KEY}

然后,通过频道id,您可以获得频道详细信息:

GET https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&id=UC6ltI41W4P14NShIBHU8z1Q&key={YOUR_API_KEY}

在这种情况下,结果是:

{
 "kind": "youtube#channelListResponse",
 "etag": "\"PsChdkLfsD-u3yuH7KChIH1CRFg/fl8vHBnZ66nKyI7QvfTRQchTAAA\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 1
 },
 "items": [
  {
   "id": "UC6ltI41W4P14NShIBHU8z1Q",
   "kind": "youtube#channel",
   "etag": "\"PsChdkLfsD-u3yuH7KChIH1CRFg/zyApGa6dWMliWq5iBE5SL4ewNaQ\"",
   "snippet": {
    "channelId": "UC6ltI41W4P14NShIBHU8z1Q",
    "title": "wheelockmarketing1",
    "description": "Since 1888, Wheelock College has been providing a transformational education to students passionate about making the world a better place—especially for children and families.\n\nWhile most of our students elect to work in the helping professions of education, social work, child life, and juvenile justice and youth advocacy, many pursue—and make exceptional contributions to—a wide variety of professions.\n\nAs a highly respected advocate for social policy, Wheelock also helps to shape and strengthen the social systems that positively impact children and families around the globe.",
    "thumbnails": {
     "default": {
      "url": "https://i3.ytimg.com/i/6ltI41W4P14NShIBHU8z1Q/1.jpg?v=4fdf2807"
     }
    }
   },
   "contentDetails": {
    "relatedPlaylists": {
     "likes": "LL6ltI41W4P14NShIBHU8z1Q",
     "favorites": "FL6ltI41W4P14NShIBHU8z1Q",
     "uploads": "UU6ltI41W4P14NShIBHU8z1Q"
    }
   },
   "statistics": {
    "viewCount": "10354",
    "commentCount": "1",
    "subscriberCount": "43",
    "videoCount": "91"
   }
  }
 ]
}

如果初始搜索返回多个结果,我们会有问题,但我相信这是一个好策略:)

 类似资料:
  • 我很困惑。据我所知,我完全遵循这些例子。也许我遗漏了一个参数,但我找不到它是什么。 控制台响应没有项目,但我有3个公共播放列表。 [Log]对象(learnadaapi.html,第68行) etag: “\”m2yskBQFythfE4irbTIeOgYYfBU/Rk41fm-2TD0VG1yv0-bkUvcBi9s\“” 项目: [] (0) 类型:“youtube#channelList响应

  • 我是youtube api的新手,我需要帮助在android中实现youtube api。我找到了一个youtube api,用于获取相关用户名上的所有频道列表https://www.googleapis.com/youtube/v3/channels?part=snippet 这是对上述具有有效用户名和 API 密钥的 api 的响应

  • 我正在尝试使用频道的视频,https://www.googleapis.com/youtube/v3/search?order=date

  • 那么,如何从“由YouTube自动生成”(主题)的频道获取发布的视频呢?https://www.youtube.com/channel/UCSkJDgBGvNOEXSQl4YNjDtQ/videos 我可以从频道调用中获取主题ID,但当我按此主题ID搜索时,得到的结果完全不同。 如果我运行搜索api调用: 我只得到播放列表和频道。无视频结果。

  • 我试图获取YouTube频道的详细信息。 根据官方API文档(https://developers.google.com/youtube/v3/docs/channels/list),我应该提供包含 https://www.googleapis.com/auth/youtubepartner-channel-audit 范围的授权令牌。 我目前正试图通过点击以下URL来获取YouTube频道的au

  • 我正在使用https://developers.google.com/youtube/的这些API,但是我想不出,给定一个youtube频道地址,如何获得带有相关信息的视频列表(至少是单个视频url和标题)