我花了几个小时试图找到一些关于如何在Windows phone8开发中使用YouTube V3 Api .NET库的信息。甚至诺基亚自己也帮不上忙,因为他们的维基页面只是展示了如何使用WebClient来做事情(即使在那里也不是很清楚)。
我已经很难找到任何与YouTube v3 Api的.NET库相关的指南或东西,并且我一直在遵循似乎不起作用的示例代码(特别是这个- https://github.com/youtube/api-samples/blob/master/dotnet/Search.cs)。
那么,有没有人可以帮我写一些或者链接到一些使用.NET库的Windows phone8示例代码,比如用来在YouTube上搜索一些东西?
发布于 2014-01-20 06:58:59
框架"MyToolkit“不包含任何搜索youtube api方法,但是搜索youtube视频非常容易(示例代码)。
private void doYouTubeSearch()
{
if (YouTubeSearchText.Text.Length > 0)
{
this.LoadingProgressBar.IsIndeterminate = true;
var wc = new WebClient();
wc.DownloadStringCompleted += DownloadStringCompleted;
var searchUri = string.Format("http://gdata.youtube.com/feeds/api/videos?q={0}&format=6", HttpUtility.UrlEncode(YouTubeSearchText.Text));
wc.DownloadStringAsync(new Uri(searchUri));
}
}
void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var atomns = XNamespace.Get("http://www.w3.org/2005/Atom");
var medians = XNamespace.Get("http://search.yahoo.com/mrss/");
var xml = XElement.Parse(e.Result);
var videos = (
from entry in xml.Descendants(atomns.GetName("entry"))
select new YouTubeViewModel
{
VideoId = entry.Element(atomns.GetName("id")).Value,
VideoImageUrl = (
from thumbnail in entry.Descendants(medians.GetName("thumbnail"))
where thumbnail.Attribute("height").Value == "360"
select thumbnail.Attribute("url").Value).FirstOrDefault(),
Title = entry.Element(atomns.GetName("title")).Value,
Description = entry.Element(atomns.GetName("content")).Value
}).ToArray(); .... more code here :-)..。你可以在这里面过滤等等。
发布于 2014-03-30 00:12:43
我在开发者控制台找不到任何与windows phone8相关的Api访问密钥。也许这就是示例不能工作的原因(?)
https://stackoverflow.com/questions/21117346
复制相似问题