Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Getting Json from twitter Stream

$
0
0
Hi all!

I'm very new to programming and would really appreciate some help.

I'm having some problem in collecting the json from the Tweetinvi real-time stream.

These are my current code.

namespace TweetinviSTREAM
{
class Program
{
    static void Main(string[] args)
    {
        string Consumer = "removed";

        string ConsumerSecret = "removed";

        string AccessToken = "removed";

        string AccessTokenSecret = "removed";

        TwitterCredentials.SetCredentials(AccessToken, AccessTokenSecret, Consumer, ConsumerSecret);

        try
        {
            TwitterStream() ;
            Json_GetJsonForSavedSearchRequestExample();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        Console.ReadLine();
    }

    private static void TwitterStream()
    {
        var stream = Tweetinvi.Stream.CreateSampleStream();
        stream.TweetReceived += (sender, args) =>
        {
            Console.WriteLine(args.Tweet.Text);
        };

        stream.StartStream();
        Console.WriteLine("Stream State: " + stream.StreamState.ToString());
        }

    private static void Json_GetJsonForSavedSearchRequestExample()
    {
        var jsonResponse = SavedSearchJson.GetSavedSearches();
        Console.WriteLine(jsonResponse);
    }
    }
}

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>