【问题标题】:get youtube video without authentication无需身份验证即可获取 youtube 视频
【发布时间】:2012-01-21 15:00:39
【问题描述】:
如何在没有开发者密钥的情况下发出 youtube 请求?
例如我有:
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/xyz123");
Video video = request.Retrieve<Video>(videoEntryUrl);
我想要视频对象,但请求对象需要凭据等 - 有没有办法解决这个问题?
documentation 确实说:
检索公共视频的只读请求不需要
身份验证。
【问题讨论】:
标签:
c#
asp.net
youtube-api
【解决方案1】:
用空值初始化你的YouTubeRequestSettings:
YouTubeRequestSettings settings = new YouTubeRequestSettings(null, null);
YouTubeRequest request = new YouTubeRequest(settings);
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/xyz123");
Video video = request.Retrieve<Video>(videoEntryUrl);