New question #403017 on Sikuli:
https://answers.launchpad.net/sikuli/+question/403017

using this code...i m getting only 7 days tweets from the #india...i want to 
get atleast six month tweets from the hashtag..
i m trying to get the tweets from particular hashtag and write it into the 
notepad....guide me to get atleast six month tweets from the hashtag india  

    FileWriter fw=null;

     BufferedWriter bw=null;

      fw=new FileWriter("D:\\india.txt");

     bw=new BufferedWriter(fw);

    ConfigurationBuilder cb = new ConfigurationBuilder();

    cb.setDebugEnabled(true)

    .setOAuthConsumerKey("xxxx")

    .setOAuthConsumerSecret("xxxx")

    .setOAuthAccessToken("xxxx")

      .setOAuthAccessTokenSecret("xxxx");

       Twitter twitter = new TwitterFactory(cb.build()).getInstance();

        Query query = new Query("#india");


      long lastID = Long.MAX_VALUE;

        ArrayList<Status> tweets = new ArrayList<Status>();

       query.setCount(100);

     try {

      QueryResult result = twitter.search(query);

     tweets.addAll(result.getTweets());

     System.out.println("Gathered " + tweets.size() + " tweets");
    for (Status t: tweets) 

      if(t.getId() < lastID) 

          lastID = t.getId();

      query.setMaxId(lastID-1);

       for (int i = 0; i < tweets.size(); i++) {
  Status t = (Status) tweets.get(i);

        String user = t.getUser().getScreenName();

       String msg = t.getText();

        Date date =t.getCreatedAt();

 bw.write("\n"+i+".USER"+"\n"+"DATE  -  "+date+"\n"+"USER"   
   +user+"\t"+" wrote"+"\n"+"MSG   -  "+t.getText()+"\n"+"="); 

     }
    } catch (TwitterException te) {

        te.printStackTrace();

        System.out.println("Failed to get timeline: " + te.getMessage());

        System.exit(-1);
    }

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to