如何使用YouTube API从播放列表中获取所有视频? [英] How get all videos from a playlist using youtube api?

查看:495
本文介绍了如何使用YouTube API从播放列表中获取所有视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在使用此链接

http://gdata.youtube.com/feeds/api/playlists/plalistID

从YouTube播放列表中检索视频.但问题是只有25个视频.但播放列表包含100个视频.如何从播放列表中获取所有视频?

to retrieve video from YouTube playlist. but the problem is only getting 25 video. but the playlist contains 100 videos. How get all video from playlist?

推荐答案

Youtube让您每个请求最多获取50个条目.
响应包含一些<link>元素.并且如果还有更多记录要提取,则其中一个记录的格式为<link rel='next' ...例如

Youtube let's you fetch up to 50 entries per request.
The response contains some <link> elements. And if there are still more records to fetch one of it is of the form <link rel='next' ... e.g.

<link
  rel='next'
  type='application/atom+xml'
  href='https://gdata.youtube.com/feeds/api/playlists/plalistID?start-index=26&amp;max-results=25&amp;v=2'
/>

搜索此元素,并获取href属性指向的文档,直到响应中没有<link rel='next'元素.

Search for this element and retrieve the document that the href attribute points to until the repsonse has no <link rel='next' element.

这篇关于如何使用YouTube API从播放列表中获取所有视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆