1

我使用此代码获取推文并将其保存到 Json 文件中。如何将其保存为单独的推文(作为 json 对象)!因为通过这种方式,所有推文的所有参数都加载在一起

        // 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();

    }
}

}

4

0 回答 0