【问题标题】:Youtube Api, Get video url with given id channel and title of videoYoutube Api,获取具有给定 ID 频道和视频标题的视频网址
【发布时间】:2019-02-10 14:30:50
【问题描述】:

例如,我需要视频的 id https://www.youtube.com/watch?v=wIN0tTy-Jmg

我需要的 id 是 wIN0tTy-Jmg

我知道 https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list?part=snippet&channelId=UCuaCWszD8Z2bZcSNvlAR6UA&maxResults=50&fields=items(snippet(thumbnails%252Fdefault%252Ctitle))&_h=14&

但它只返回 50 个视频,有时我无法获得具有我需要的标题的视频

我只需要一个视频 ID,我知道标题和给定的频道 ID

如何获得这个ID?有什么想法吗?

【问题讨论】:

  • 是你的视频吗?
  • 是的,这是我的视频

标签: google-api youtube-data-api


【解决方案1】:

youtube api 没有视频获取方法。所以没有办法直接得到一个视频。

我不确定你为什么使用activites.list 方法。

我会使用 search.list 并发送频道 ID。 example

请求

GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCWnY0GoKFnFY0oeaEN605Ug&maxResults=50&key={YOUR_API_KEY}

回复

{
 "kind": "youtube#searchListResponse",
 "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/9HyOjSMVnKv1vm239plm060CuiY\"",
 "nextPageToken": "CDIQAA",
 "regionCode": "DK",
 "pageInfo": {
  "totalResults": 71,
  "resultsPerPage": 50
 },
 ...

}

它仍然返回超过最大 50 行。您将不得不使用下一页令牌来获取下一页结果。

【讨论】:

    猜你喜欢
    • 2017-10-09
    • 2018-10-16
    • 2013-03-08
    • 2018-03-30
    • 2014-08-16
    • 2016-03-01
    • 2016-05-13
    • 2012-05-22
    • 2019-12-14
    相关资源
    最近更新 更多