需要帮助以使用YouTube搜索API获得100多个结果 [英] Need help to get more than 100 results using YouTube search API

查看:106
本文介绍了需要帮助以使用YouTube搜索API获得100多个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用YouTube API检索100多个结果?

Is there some way I can retrieve more than 100 results using YouTube API?

我可以使用以下查询字符串检索多达100个结果: https://gdata.youtube.com/feeds/api/videos?q=football&orderby=relevance&start-index=1&max-results=10&v=2

I can retrive upto 100 results using this query string: https://gdata.youtube.com/feeds/api/videos?q=football&orderby=relevance&start-index=1&max-results=10&v=2

但是当我尝试 https://gdata.youtube.com/feeds/api/videos?q=football&orderby=relevance&start-index=101&max-results=10&v=2

我得到: http://www.w3.org/2005/Atom'xmlns:openSearch =' http://a9.com/-/spec/opensearch/1.1/'xmlns:gd =' http://schemas.google.com/g/2005 'gd:etag ='W/"C0YFQHg9fyp7I2A9WhBVGUk."''tag:youtube.com,2008:videos2013-04-26T01:51:51.667Zhttp://schemas.google.com/g/2005#kind'term =' http://gdata. youtube.com/schemas/2007#video '/>匹配的视频:足球 http://www.youtube.com/img/pic_youtubelogo_123x63.gif https://www.youtube.com'/> http://schemas.google.com/g/2005#feed'type ='application/atom + xml'href =' https://gdata.youtube.com/feeds/api/videos?v = 2 '/>http://schemas.google.com/g/2005#batch'type ='application/atom + xml'href =' http://www.youtube.com/ http://gdata.youtube.com'> YouTube数据API10010110

I get: http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/"C0YFQHg9fyp7I2A9WhBVGUk."'>tag:youtube.com,2008:videos2013-04-26T01:51:51.667Zhttp://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>Videos matching: footballhttp://www.youtube.com/img/pic_youtubelogo_123x63.gifhttps://www.youtube.com'/>http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/videos?v=2'/>http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/videos/batch?v=2'/>https://gdata.youtube.com/feeds/api/videos?q=football&start-index=101&max-results=10&orderby=relevance&v=2'/>https://gdata.youtube.com/feeds/api/videos?alt=atom-service&v=2'/>https://gdata.youtube.com/feeds/api/videos?q=football&start-index=91&max-results=10&orderby=relevance&v=2'/>YouTubehttp://www.youtube.com/http://gdata.youtube.com'>YouTube data API10010110

据我了解,使用YouTube搜索API可以获得999个结果.为什么这里限制为100?是否有一种变通方法可以让我获得100多个结果?

From what I understand, you can get 999 results using YouTube search API. Why is this limited to 100 here? Is there a workaround for me to get more than 100 results?

谢谢!

推荐答案

我不能说内部是否发生了变化,现在将totalResults限制为100,但这似乎是一个很普遍的问题今天.但是,如果您尝试使用API​​的v3,则不会有问题:例如,以下查询:

I can't speak to whether or not something has changed internally that is now capping totalResults at 100, but it seems to be a pretty common problem across the board today. However, if you were to try using v3 of the API, this wouldn't be an issue: for example, this query:

https://www.googleapis.com/youtube/v3/search?q = football& part = id& key = YOUR_DEVELOPER_KEY

将为您带来很多更多的总结果.使用v3,您可以将maxResults参数设置为每个响应最多返回50个视频,然后通过将pageToken参数设置为给定响应的"nextPageToken"属性来对响应进行分页.

Will give you many, many more total results. With v3, you can set the maxResults parameter up to 50 videos returned for each response, and then paginate through the responses by setting the pageToken parameter to whatever the "nextPageToken" attribute of a given response is.

这篇关于需要帮助以使用YouTube搜索API获得100多个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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