Reputation: 11
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();
}
}
}
Upvotes: 1
Views: 109