我正在使用twitter4j从twitter中提取推文。我想知道在我检索推文之后,我怎样才能将这些推文写入csv文件?非常感谢!
package test;
import twitter4j.*;
import twitter4j.conf.ConfigurationBuilder;
import java.io.IOException;
import java.sql.*;
import java.util.Calendar;
import java.io.FileWriter;
public class test {
public static void main(String[] args) throws TwitterException, IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("XXX")
.setOAuthConsumerSecret("XXX")
.setOAuthAccessToken("XX")
.setOAuthAccessTokenSecret("XX");
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
Query query = new Query("your keywords");
query.setCount(200);
query.geoCode(new GeoLocation(XX, XXX), 200, Query.KILOMETERS);
QueryResult result = twitter.search(query);
}
}