1

I used this code to fetch tweets and save it into Json file. How can I save it as individual tweets(as json object)! because by this way all the arguments load together for all tweets

        // Create the Stream
        var stream = Stream.CreateFilteredStream();

        // Keywords to Track
        stream.AddTrack("Disney");


        // Limit to English 
        stream.AddTweetLanguageFilter(LanguageFilter.English);

        // Message so you know its running
        Console.WriteLine("Connected to Twitter!");





        // Called when a tweet maching the tracker is produced
        stream.MatchingTweetReceived += (sender, arguments) =>
        {

            Console.Write(arguments.Tweet.Text);


        };
        stream.JsonObjectReceived += (sender, arguments) =>
        {


            System.IO.File.WriteAllText("tweets.json", arguments.Json );

        };

        stream.StartStreamMatchingAllConditions();
        Console.ReadKey();

    }
}

}

Vow
  • 11
  • 3
  • Hello, could you please be more descriptive as what you are trying to achieve as I do not understand. By the way the saving logic will not work on the long term as the machine will probably not be able to save the tweets at the speed they will arrive. The stream will start receive a `warning` from Twitter informing you that you will be disconnected. The proper solution is to save by chunks of let say 100 tweets at once. Or push each request in a proper queue. – Linvi Mar 19 '18 at 14:08
  • can I please contact you ? – Vow Mar 23 '18 at 10:16
  • Hello, you can send me any message on https://gitter.im/linvi/tweetinvi – Linvi Mar 26 '18 at 07:31

0 Answers0