Twitter Streaming API C #

Hello everyone who knows how to use the streaming API for C #? Therefore, whenever a new tweet appears in my account, it will be reflected in my program.

+7
source share
4 answers

I found a good example of code that uses the streaming API, here is Twitterizer .

-2
source

So far, the only reliable shell I have found for this in .Net land, TweetInvi . Try to ignore the website as if it was designed by a hyperactive 10 year old (thanks to the MS 'metro team), the actual library is very well designed and robust.

Assuming you have the appropriate access tokens (if you don't see http://dev.twitter.com ), an example of how easy it is to do this:

TwitterCredentials.SetCredentials(userToken,userTokenPrivate,apiKey,apiKeyPrivate); _userStream = Stream.CreateUserStream(); _userStream.TweetCreatedByFriend += (sender,args) => Console.WriteLine(args.Tweet.Text); _userStream.Start(); 

This will write the body of the tweets to your console output, and it will update even faster than leaving the actual Twitter website. There are other events open for when a tweet is beneficial, reread when you have a new follower, etc.

I can guarantee that this library was reliable - I use it for the CovertTweeter project and have not had any problems with it. In fact, accessing the streaming API via TweetInvi was even easier than the many brick walls I left when I used REST wrappers such as Linq2Twitter and TweetSharp.

+11
source

Take a look at this post:

Streaming with the new .NET HttpClient and HttpCompletionOption.ResponseHeadersRead

You do not have full implementation, but you get this idea.

+5
source

Here is an example that "Reads data from the Twitter streaming API and adds it to MSMQ. The second process (included) reads from the queue, parses the json message, and updates the data store."

https://github.com/swhitley/TwitterStreamClient

You can modify the above problem to create an event when it updates the data store. In your program, you can subscribe to this event to do whatever you want.

If you are looking for a sample based on OAuth, please use the "AuthPack", which provides .NET oAuth for Twitter, Facebook, LinkedIn and Google:

https://github.com/swhitley/AuthPack/tree/master/AuthPack

+2
source

All Articles