setup Tweetinvi API

May 18, 2014 at 11:13 AM
Hi everybody

would u plz explain me that how can I setup all these code and get a stream of tweets as an output ? :D
I'm sorry for starting such a discussion , but I'm new in this and need this. I'm really grateful if sombody help me in this.
Coordinator
May 18, 2014 at 10:53 PM
Hi,

I would recommend that you read the twitter documentation.
The logic of Tweetinvi is that you have a credentials that are scoped to a Thread.

To set your credentials use the following line:
TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
To get tweets from the sample stream do the following:
var sampleStream = Stream.CreateSampleStream();
sampleStream.TweetReceived += (sender, args) => { Console.WriteLine(args.Tweet.Text); };
sampleStream.StartStream();
Please read the documentation and if you have further request let me know.

Linvi
Marked as answer by linvi on 5/19/2014 at 9:53 AM
May 21, 2014 at 4:18 AM
I'm sorry and I'm sure the answer is simple, but I just cannot get the stream to work. I:
1) Create new windows forms project
2) Create a method called StartTheStream
3) Copy the code above to the method
4) Put a button on the form
5) start the app and press the button
6) No errors, but not streams

If I do below I can poll without issues:
        // Complex search
        var searchParameter = Search.GenerateSearchTweetParameter(Geo.GenerateCoordinates(-98.5795, 39.828), 1500, DistanceMeasure.Miles);
        searchParameter.Lang = Language.English;
        searchParameter.SearchType = SearchResultType.Recent;
        searchParameter.MaximumNumberOfResults = 10;
        var tweets = Search.SearchTweets(searchParameter);
But I would rather get the tweet stream.

Thanks in advance.
Coordinator
May 21, 2014 at 1:32 PM
Hi,

To help you there is already a Winform example project.
Please download it from here.
If it does not help, poke me again!

Linvi
May 21, 2014 at 3:20 PM

Got it!

Thanks.

--Patrick

May 21, 2014 at 9:03 PM
Thanx, I'll try it. :)