我在这找不到最近的答案。tweetsharp和api流?
Tweetsharp据报道在一些旧帖子中不支持来自Twitter用户流api的流式传输。然而,github展示了一个类似于它支持流式传输的类。
是否tweetsharp现在支持来自Twitter,在那里我学习C#和我会很感激有经验的编码器的观点之前,我继续花时间与工作没有
之前流tweetsharp。
我在这找不到最近的答案。tweetsharp和api流?
Tweetsharp据报道在一些旧帖子中不支持来自Twitter用户流api的流式传输。然而,github展示了一个类似于它支持流式传输的类。
是否tweetsharp现在支持来自Twitter,在那里我学习C#和我会很感激有经验的编码器的观点之前,我继续花时间与工作没有
之前流tweetsharp。
如果你搜索的内容只Twitter's streaming API,可以实现它,而不需要外部库
JavaScriptSerializer serializer = new JavaScriptSerializer();
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://stream.twitter.com/1/statuses/sample.json");
webRequest.Credentials = new NetworkCredential("...", "...");
webRequest.Timeout = -1;
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
StreamReader responseStream = new StreamReader(webResponse.GetResponseStream());
while (true)
{
var line = responseStream.ReadLine();
if (String.IsNullOrEmpty(line)) continue;
dynamic obj = serializer.Deserialize<Dictionary<string, object>>(line);
if(obj["user"]!=null)
Console.WriteLine(obj["user"]["screen_name"] + ": " + obj["text"]);
}
什么是你的问题? – 2012-03-20 00:09:50
好点。 tweetsharp现在是否支持通过Twitter进行流式传输,在此之前它没有 – Damo 2012-03-20 00:11:30
这可能会帮助你:[** TweetSharp - FluentTwitter去哪儿?](http://stackoverflow.com/questions/6587176/where-did- fluenttwitter-go) – bevacqua 2012-03-20 00:12:13