youtube - 如何从YouTube数据API搜索结果中删除 `limitedSyndication`

标签 youtube gdata-api youtube-api gdata

以下查询将返回结果,但其中一些将包含limitedSyndication限制。不能通过formatrestriction参数将其滤除。
http://gdata.youtube.com/feeds/api/videos?alt=json-in-script&callback=jQuery.youtube.response&q=Madonna&v=2&format=5&start-index=11&max-results=10
上面的查询中未使用restriction参数,因为YouTube Data API reference guide声明以下内容:

By default, the API filters out videos that cannot be played in the country from which you send API requests.



难道我做错了什么? (除了搜索麦当娜)

如何摆脱limitedSyndication结果,或者这是一个错误?

最佳答案

如GData文档中所述,您可以传递一个“限制”参数,该参数将过滤出所传递的ip无法播放的结果,因此您只需要获取用户的IP并将其传递给请求即可:

To request videos playable from a specific computer, include the restriction parameter in your request and set the parameter value to the IP address of the computer where the videos will be played – e.g. restriction=255.255.255.255. To request videos that are playable in a specific country, include the restriction parameter in your request and set the parameter value to the ISO 3166 two-letter country code of the country where the videos will be played – e.g. restriction=DE. You should include this parameter in any request to retrieve a list of videos, including search results, playlists, favorite videos, video responses and so forth. If a video in the API response is not playable in the location that you're using to restrict availability of the content, the <entry> for that tag will not contain a <media:content> tag. However, it will contain a <yt:state> tag that indicates that the video is restricted.

关于youtube - 如何从YouTube数据API搜索结果中删除 `limitedSyndication`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1231417/

相关文章:

php - 如何使嵌入式iframe上的YouTube播放器正常工作,而不阻止Chrome中的页面加载?

iphone - 在 iphone 应用程序中播放 youtube 视频

video - 如何在Pinterest上分享嵌入式YouTube视频?

google-calendar-api - 检索 Google 日历所有者的电子邮件地址

youtube - YouTube API v3 Activity.List() 是否按 PublishedAt 日期排序?

api - 使用 playerVars : { 'rel' : 0 } for removing but it not working 的 Youtube 视频 API

ruby - 使用 http 协议(protocol)访问启用了 SSL 的 Google Apps 提要

java - 是否推荐使用 GAE 类型?

Youtube API v3 ipRefererBlocked

json - 使用 alt=json-in-script&callback 检索信息 V3 youtube API