twitter4j - access tweet information from Streaming API

后端 未结 3 581
我在风中等你
我在风中等你 2021-02-01 11:01

My goal is to collect all tweets containing the words \"France\" and \"Germany\" and to also collect associated metadata (e.g., the geo coordinates attached to the tweet). I kno

3条回答
  •  感情败类
    2021-02-01 11:55

    To write tweets on file:

    FileWriter file = new FileWriter(....);
    
    public void onStatus(Status status) {
        System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText() + " -> "+ status.getCreatedAt());
        try {
            file.write(status.getUser().getScreenName() + " - " + status.getText() + " -> "+ status.getCreatedAt() +"\n");
            file.flush();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    

提交回复
热议问题