简体   繁体   English

Twitterizer搜索

[英]Twitterizer Search

We are new to Twitter Api / Twitterizer. 我们是Twitter Api / Twitterizer的新手。

We have used the twitter search and then edited the URL as per the Twitter help and everything is fine ( http://search.twitter.com/search.json?q=manchester%20airport%20delay ). 我们使用了Twitter搜索,然后根据Twitter帮助编辑了URL,一切正常( http://search.twitter.com/search.json?q=manchester%20airport%20delay )。

What we would like to do now is apply the same search using Twitterizer in our C# code. 我们现在想做的是在我们的C#代码中使用Twitterizer应用相同的搜索。

Could anyone point us in the right direction. 任何人都可以向我们指出正确的方向。

Searches with Twitterizer are pretty straight forward, since no authorization is required (or even accepted). 使用Twitterizer进行搜索非常简单,因为不需要(甚至不接受)授权。

Here is a code sample to perform the search you linked to and looping through the results. 这是一个代码示例,用于执行您链接到的搜索并遍历结果。

TwitterResponse<TwitterSearchResultCollection> searchResponse = TwitterSearch.Search("manchester airport delay");

// You should check that the request was successfull. If not, log/display/handle it.
if (searchResponse.Result != RequestResult.Success)
{
    // An example method call
    LogAndDisplayError(searchResponse.ErrorMessage);
}
else
{
    // The ResponseObject property will be a TwitterSearchResultCollection
    // You can bind many controls' datasource directly to the ResponseObject
    foreach (TwitterSearchResult result in searchResponse.ResponseObject)
    {
        // Which means each result will be a TwitterSearchResult
        DisplayResult(result);
    }
}

与其自行构建,不如看一下http://linqtotwitter.codeplex.com/上的LINQ to Twitter项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM