在Metro应用中使用RetrieveFeedAsync获取Twitter搜索结果

本文关键字:RetrieveFeedAsync 获取 Twitter 搜索结果 Metro 应用 | 更新日期: 2023-09-27 18:09:03

熟悉Metro应用程序,所以我想我应该试试我的手一些twitter的东西。下面的代码不起作用

public static async Task<IEnumerable<TwitterItem>> Search(string term)
{
    var search = new SyndicationClient();
    var searchUri = new Uri("http://search.twitter.com/search.atom?q=" + term);
    //var searchUri = new Uri("http://windowsteamblog.com/windows/b/developers/atom.aspx");
    var results = await search.RetrieveFeedAsync(searchUri);
    return from item in results.Items
           select new TwitterItem
           {
               Text = item.Title.Text,
               CreatedAt = item.PublishedDate.DateTime,
               FromUser = item.Authors[0].Name
           };
}

如果我使用windows团队博客url而不是twitter url,它就可以工作。没有例外,它永远不会回来。尝试使用fiddler,但由于某种原因无法拦截Metro流量。任何想法吗?

在Metro应用中使用RetrieveFeedAsync获取Twitter搜索结果

我同意@Jon的观点。

请用Fiddler调试这段代码,以确保你没有生成一个格式错误的url。

请参阅此答案以获取有关使用Fiddler与Metro应用程序的更多信息。

相关文章:
  • 没有找到相关文章