List of usage examples for twitter4j TwitterFactory getInstance
public Twitter getInstance()
From source file:edu.uci.ics.asterix.external.util.TwitterUtil.java
License:Apache License
public static Twitter getTwitterService(Map<String, String> configuration) { ConfigurationBuilder cb = getAuthConfiguration(configuration); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); return twitter; }
From source file:edu.umich.cse.pyongjoo.twittercrawl.GetUserTimeline.java
License:Apache License
/** * Usage: java twitter4j.examples.timeline.GetUserTimeline * * @param args String[]//from w w w .j a va2 s . co m * @throws IOException */ public static void main(String[] args) throws IOException { OAuthTokenReader oauth = new OAuthTokenReader("oauth_tokens.csv"); TwitterFactory tf = new TwitterFactory(oauth.getNextConfiguration()); // gets Twitter instance with default credentials Twitter twitter = tf.getInstance(); if (args.length < 2) { System.err.println("Usuage: command [username] [outputfile]"); System.exit(-1); } String filename = args[1]; FileWriter fstream = new FileWriter(filename, true); BufferedWriter out = new BufferedWriter(fstream); String user = ""; if (args.length >= 1) { user = args[0]; } // out.write("#document starts with username: " + user + "\n"); for (int i = 1; i <= 1; i++) { Paging pagingOption = new Paging(i, 200); try { List<Status> statuses; statuses = twitter.getUserTimeline(user, pagingOption); System.out.println("My Custom Showing @" + user + "'s user timeline."); for (Status status : statuses) { out.write(status.toString() + '\n'); System.out.println(status.getUser().getScreenName() + "tweets written."); } } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); // close the file out.close(); // output.close(); System.exit(-1); } } // close the file out.close(); // output.close(); }
From source file:ens.demo.twitter.TwittEmergencyMessage.java
@Override public void run() { try {//from ww w . ja v a 2 s .co m if (toCustomer.getToken() == null || toCustomer.getToken().isEmpty()) { return; } ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Properties properties = new Properties(); properties.load(classLoader.getResourceAsStream("twitter4j.properties")); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey(properties.getProperty("twitter4j.oauth.consumerKey")) .setOAuthConsumerSecret(properties.getProperty("twitter4j.oauth.consumerSecret")) .setOAuthAccessToken(toCustomer.getToken()) .setOAuthAccessTokenSecret(toCustomer.getTokenSecret()); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); StatusUpdate update = new StatusUpdate(message); Status status = twitter.updateStatus(update); System.out.println("Successfully updated the status to [" + status.getText() + "]."); } catch (TwitterException ex) { Logger.getLogger(TwittEmergencyMessage.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(TwittEmergencyMessage.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:entities.TwitterFeed.java
public void initTimeline() { timelineFrame = new JFrame("@SIM_IST Timeline"); timelineFrame.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); timelineBack = new JButton("Back"); timelineBack.addActionListener(this); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5;/* w w w . j av a2 s. c o m*/ c.gridx = 1; c.gridy = 1; c.gridwidth = 1; timelineFrame.add(timelineBack, c); timelineTweets = new JTextArea(); Font font = new Font("Gotham Narrow", Font.BOLD, 12); timelineTweets.setFont(font); timelineTweets.setEditable(false); timelineScrollPane = new JScrollPane(timelineTweets); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.ipady = 200; c.gridx = 0; c.gridy = 0; c.gridwidth = 3; timelineFrame.add(timelineScrollPane, c); KeyReader keys = new KeyReader(); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey(keys.getConsumerKey()) .setOAuthConsumerSecret(keys.getConsumerSecret()).setOAuthAccessToken(keys.getAccessToken()) .setOAuthAccessTokenSecret(keys.getAccessTokenSecret()); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); try { System.out.println("timeline retreval worked"); List<Status> statuses = twitter.getHomeTimeline(); for (Status status : statuses) { timelineTweets .append("@" + status.getUser().getScreenName() + " : " + status.getText() + "\n" + "\n"); timelineTweets.setLineWrap(true); timelineTweets.setWrapStyleWord(true); timelineTweets.setCaretPosition(0); System.out.println("@" + status.getUser().getName() + " : " + status.getText()); } } catch (TwitterException te) { System.out.print("timeline retreval failed"); te.printStackTrace(); } timelineFrame.pack(); timelineFrame.setSize(600, 300); timelineFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); timelineFrame.setLocationRelativeTo(null); timelineFrame.setVisible(true); }
From source file:erando.controllers.AddProductController.java
@FXML private void addProductAction(ActionEvent event) throws FileNotFoundException, IOException, TwitterException, DocumentException { Product p = new Product(); Sms sms = new Sms(); ISms smsservice = new SmsService(); IShopService productService = new ProductService(); Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("YYYY:MM/HH:mm:ss"); p.setTitre(pTitre.getText());/*from w w w . jav a 2 s .c o m*/ p.setPrix(Integer.parseInt(pPrix.getText())); p.setDescription(pDescription.getText()); p.setType(pType.getValue().toString()); p.setDate(sdf.format(cal.getTime())); p.setImage(imageName); if (!pTitre.getText().isEmpty() && !pPrix.getText().isEmpty() && !pDescription.getText().isEmpty() && !pType.getValue().toString().isEmpty()) { productService.add(p); ////////send sms to subs sms.setNum("" + Parameters.user.getNumTel()); sms.setMessagetel("Product Added To Store go check it !"); smsservice.sendSms(sms); ////////share on facebook (when asked by the owner ! ) if (shareFacebook.isSelected()) { String accessToken = "EAACEdEose0cBAKLtkZBKZCBoEkx4MApf3HxDMAR93PoJ6lAAuZAMdfY9vtob2ii78C6TN88hSV8HK0tDZBskaUz5pcbH1HqVeDRISuEHsG0qqUZBca4gHGnANPWcZBSZA9RNFHpbwVHJ46ITntn52SGQWetPPaZBsNlsFXbpcDrKytOVtmspQzfrM8GiUQtm1kQZD"; FacebookClient fbClient = new DefaultFacebookClient(accessToken, Version.LATEST); File fs = new File("C:\\Users\\F.Mouhamed\\Desktop\\Esprit\\ERandoPi\\userfiles\\"); fs.getParentFile().setExecutable(true); fs.getParentFile().setReadable(true); fs.getParentFile().setWritable(true); ////////FileInputStream fis = new FileInputStream(fs.getParentFile()); User me = fbClient.fetchObject("me", User.class); FacebookType response; response = fbClient.publish("me/feed", FacebookType.class, Parameter.with("message", p.getTitre() + "\n " + p.getDescription() + "\n Prix:" + p.getPrix())); } ////////share on twitter (when asked by the owner ! ) if (shareTwitter.isSelected()) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("dHU6c4cXI6HDeLI3pakG8PYtp") .setOAuthConsumerSecret("n0NxZVXgpEMGJboWYBSD1nfbaa3Ov2qL0e9h2GzyUsa8wQ0q0p") .setOAuthAccessToken("729655065716346881-gukmKiOsT5WFv05t3yfQFrWgoPycQGD") .setOAuthAccessTokenSecret("4qTGW5YdG8j9biJeAybzIcivCPZaAOqES2PhoJI9S7WKL"); TwitterFactory tf = new TwitterFactory(cb.build()); twitter4j.Twitter tw = tf.getInstance(); String StatusMessage = ("Titre :" + p.getTitre() + "\nDescription:\n" + p.getDescription() + "\nPrix:" + p.getPrix()); StatusUpdate status = new StatusUpdate(StatusMessage); tw.updateStatus(status); } /////////show notification Notifications notificationBuilder = Notifications.create().title("sucess").text("produit ajouter") .graphic(null).hideAfter(Duration.seconds(4)).position(Pos.BOTTOM_RIGHT); notificationBuilder.darkStyle(); notificationBuilder.showConfirm(); /////////send emails to users subscribed to this type of product List<String> subs = productService.getSubscribes(p.getType()); mailToSubs mails = new mailToSubs(); for (String s : subs) { mails.envoyerfacture(s.toString(), p.getImage().toString(), p.getId(), p.getTitre(), p.getPrix(), p.getDescription()); } } }
From source file:es.upm.oeg.entity.extractor.extractor.gate.TwitterCorpus.java
public void createCorpus() { repository = new FarolasRepo(); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); try {//w w w . ja v a 2 s .c o m corpus = Factory.newCorpus("tweetcorpus"); Query query = new Query(queryString); //"oddfarolas" QueryResult result; result = twitter.search(query); List<Status> tweets = result.getTweets(); for (Status tweet : tweets) { Document doc = Factory.newDocument(tweet.getText()); doc.setName(String.valueOf(tweet.getId())); corpus.add(doc); logger.info(tweet.getId() + " @" + tweet.getUser().getScreenName() + " - " + tweet.getText() + " -" + tweet.getGeoLocation()); repository.instanciateNew(String.valueOf(tweet.getId()), tweet.getUser().getScreenName(), tweet.getText(), tweet.getGeoLocation()); } } catch (TwitterException te) { logger.error(te); logger.error("Failed to search tweets: " + te.getMessage()); System.exit(-1); } catch (ResourceInstantiationException ex) { logger.error(ex); } logger.info("corpus size" + corpus.size()); }
From source file:formel0api.Game.java
License:Open Source License
private void sendHighScoreToServer() { try {/*from w w w . ja va 2 s. co m*/ String now = this.javaDate2XmlDate(new Date()).toString(); StringBuffer xmlStr = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<highScoreRequestType \n" + " xmlns=\"http://big.tuwien.ac.at/we/highscore/data\" \n" + " xmlns:ssd=\"http://www.dbai.tuwien.ac.at/education/ssd/SS13/uebung/Tournament\">\n" + "\n" + " <UserKey>34EphAp2C4ebaswu</UserKey>\n" + " <ssd:tournament start-date=\"" + now + "\" end-date=\"" + now + "\" registration-deadline=\"" + now + "\">\n" + " <ssd:players>\n" + " <ssd:player username=\"" + this.getLeaderData().getName() + "\">\n" + " <ssd:date-of-birth>" + this.getFormattedDate(this.getLeaderData().getBirthday()) + "</ssd:date-of-birth>\n" + " <ssd:gender>" + this.getLeaderData().getSex() + "</ssd:gender>\n" + " </ssd:player>\n" + " </ssd:players>\n" + " <ssd:rounds>\n" + " <ssd:round number=\"0\">\n" + " <ssd:game date=\"" + now + "\" status=\"finished\" duration=\"" + this.getSpentTime() + "\" winner=\"" + this.getLeaderData().getName() + "\">\n" + " <ssd:players>\n" + " <ssd:player ref=\"" + this.getLeaderData().getName() + "\"/>\n" + " </ssd:players>\n" + " </ssd:game>\n" + " </ssd:round>\n" + " </ssd:rounds>\n" + " </ssd:tournament>\n" + "</highScoreRequestType>"); JAXBContext jaxbContext = JAXBContext.newInstance(HighScoreRequestType.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); HighScoreRequestType request = (HighScoreRequestType) jaxbUnmarshaller .unmarshal(new StreamSource(new StringReader(xmlStr.toString()))); PublishHighScoreService service = new PublishHighScoreService(); PublishHighScoreEndpoint endpoint = service.getPublishHighScorePort(); String uuid = endpoint.publishHighScore(request); Logger.getLogger(Game.class.getName()).log(Level.INFO, uuid); TwitterStatusMessage tmsg = new TwitterStatusMessage(this.getLeader().getName(), uuid, new Date()); (new ITwitterClient() { @Override public void publishUuid(TwitterStatusMessage message) throws Exception { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("GZ6tiy1XyB9W0P4xEJudQ") .setOAuthConsumerSecret("gaJDlW0vf7en46JwHAOkZsTHvtAiZ3QUd2mD1x26J9w") .setOAuthAccessToken("1366513208-MutXEbBMAVOwrbFmZtj1r4Ih2vcoHGHE2207002") .setOAuthAccessTokenSecret("RMPWOePlus3xtURWRVnv1TgrjTyK7Zk33evp4KKyA"); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); twitter.updateStatus(message.toString()); } }).publishUuid(tmsg); message = "UUID " + uuid + " wurde auf Twitter verffentlicht"; } catch (JAXBException e) { Logger.getLogger(Game.class.getName()).log(Level.SEVERE, null, e); } catch (Failure e) { Logger.getLogger(Game.class.getName()).log(Level.SEVERE, e.getFaultInfo().getDetail()); } catch (Exception ex) { Logger.getLogger(Game.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:fr.istic.taa.jaxrs.StatusEndpoint.java
License:Apache License
@GET @Path("/postTweet") @Produces(MediaType.APPLICATION_JSON)/* w w w.j a v a2 s . co m*/ public String getTweet() throws IOException, TwitterException { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("jUTzyyI3zjBqiKQqhfQyFeqpm") .setOAuthConsumerSecret("gMkOSO9EYqlzrnq35kdoZIqvX12sJwP1wHKMqo6uYbvq2q0LGl") .setOAuthAccessToken("89767958-C2cLIz69SpdR6wmQGdzE8rQSXAMzIVBpYOuaZGmHQ") .setOAuthAccessTokenSecret("oG7FQJMQsX2OHKxcaHjUxgZI94ZqUShGi0qCAsI50xfpZ"); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); String latestStatus = "TEST55555555"; Status status = twitter.updateStatus(latestStatus); System.out.println("Successfully updated the status to [" + status.getText() + "]."); return "Successfully updated status to " + status.getText(); }
From source file:fr.istic.taa.jaxrs.StatusEndpoint.java
License:Apache License
@GET @Path("/sendTweet") @Produces(MediaType.APPLICATION_JSON)/*from w ww . j a va 2 s . c om*/ public String sendTweet() throws IOException, TwitterException { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("jUTzyyI3zjBqiKQqhfQyFeqpm") .setOAuthConsumerSecret("gMkOSO9EYqlzrnq35kdoZIqvX12sJwP1wHKMqo6uYbvq2q0LGl") .setOAuthAccessToken("89767958-C2cLIz69SpdR6wmQGdzE8rQSXAMzIVBpYOuaZGmHQ") .setOAuthAccessTokenSecret("oG7FQJMQsX2OHKxcaHjUxgZI94ZqUShGi0qCAsI50xfpZ"); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); String recipientId; recipientId = "@nassssssiim"; String message; message = "test"; DirectMessage message1 = twitter.sendDirectMessage(recipientId, message); System.out.println(" to @" + message1.getRecipientScreenName()); return " to @" + message1.getRecipientScreenName(); }
From source file:friendsandfollowers.DBFollowersIDs.java
License:Apache License
public static void main(String[] args) throws ClassNotFoundException, SQLException, JSONException, FileNotFoundException, UnsupportedEncodingException { // Check arguments that passed in if ((args == null) || (args.length == 0)) { System.err.println("2 Parameters are required plus one optional " + "parameter to launch a Job."); System.err.println("First: String 'OUTPUT: /output/path/'"); System.err.println("Second: (int) Number of ids to fetch. " + "Provide number which increment by 5000 " + "(5000, 10000, 15000 etc) " + "or -1 to fetch all ids."); System.err.println("Third (optional): 'screen_name / user_id_str'"); System.err.println("If 3rd argument not provided then provide" + " Twitter users through database."); System.exit(-1);/* ww w .ja v a 2 s . c o m*/ } MysqlDB DB = new MysqlDB(); AppOAuth AppOAuths = new AppOAuth(); Misc helpers = new Misc(); String endpoint = "/followers/ids"; String OutputDirPath = null; try { OutputDirPath = StringEscapeUtils.escapeJava(args[0]); } catch (Exception e) { System.err.println("Argument" + args[0] + " must be an String."); System.exit(-1); } int IDS_TO_FETCH_INT = -1; try { IDS_TO_FETCH_INT = Integer.parseInt(args[1]); } catch (NumberFormatException e) { System.err.println("Argument" + args[1] + " must be an integer."); System.exit(-1); } int IDS_TO_FETCH = 0; if (IDS_TO_FETCH_INT > 5000) { float IDS_TO_FETCH_F = (float) IDS_TO_FETCH_INT / 5000; IDS_TO_FETCH = (int) Math.ceil(IDS_TO_FETCH_F); } else if ((IDS_TO_FETCH_INT <= 5000) && (IDS_TO_FETCH_INT > 0)) { IDS_TO_FETCH = 1; } String targetedUser = ""; if (args.length == 3) { try { targetedUser = StringEscapeUtils.escapeJava(args[2]); } catch (Exception e) { System.err.println("Argument" + args[2] + " must be an String."); System.exit(-1); } } try { TwitterFactory tf = AppOAuths.loadOAuthUser(endpoint); Twitter twitter = tf.getInstance(); int RemainingCalls = AppOAuths.RemainingCalls; int RemainingCallsCounter = 0; System.out.println("First Time Remianing Calls: " + RemainingCalls); String Screen_name = AppOAuths.screen_name; System.out.println("First Time Loaded OAuth Screen_name: " + Screen_name); IDs ids; System.out.println("Listing followers ids."); // if targetedUser not provided by argument, then look into database. if (StringUtils.isEmpty(targetedUser)) { String selectQuery = "SELECT * FROM `followers_parent` WHERE " + "`targeteduser` != '' AND " + "`nextcursor` != '0' AND " + "`nextcursor` != '2'"; ResultSet results = DB.selectQ(selectQuery); int numRows = DB.numRows(results); if (numRows < 1) { System.err.println("No User in database to get followersIDS"); System.exit(-1); } OUTERMOST: while (results.next()) { int followers_parent_id = results.getInt("id"); targetedUser = results.getString("targeteduser"); long cursor = results.getLong("nextcursor"); System.out.println("Targeted User: " + targetedUser); int idsLoopCounter = 0; int totalIDs = 0; // put idsJSON in a file PrintWriter writer = new PrintWriter(OutputDirPath + "/" + targetedUser, "UTF-8"); // call different functions for screen_name and id_str Boolean chckedNumaric = helpers.isNumeric(targetedUser); do { ids = null; try { if (chckedNumaric) { long LongValueTargetedUser = Long.valueOf(targetedUser).longValue(); ids = twitter.getFollowersIDs(LongValueTargetedUser, cursor); } else { ids = twitter.getFollowersIDs(targetedUser, cursor); } } catch (TwitterException te) { // do not throw if user has protected tweets, // or if they deleted their account if (te.getStatusCode() == HttpResponseCode.UNAUTHORIZED || te.getStatusCode() == HttpResponseCode.NOT_FOUND) { System.out.println(targetedUser + " is protected or account is deleted"); } else { System.out.println("Followers Get Exception: " + te.getMessage()); } // If rate limit reached then switch Auth user RemainingCallsCounter++; if (RemainingCallsCounter >= RemainingCalls) { // load auth user tf = AppOAuths.loadOAuthUser(endpoint); twitter = tf.getInstance(); System.out.println( "New User Loaded OAuth" + " Screen_name: " + AppOAuths.screen_name); RemainingCalls = AppOAuths.RemainingCalls; RemainingCallsCounter = 0; System.out.println("New Remianing Calls: " + RemainingCalls); } // update cursor in "followers_parent" String fieldValues = "`nextcursor` = 2"; String where = "id = " + followers_parent_id; DB.Update("`followers_parent`", fieldValues, where); // If error then switch to next user continue OUTERMOST; } if (ids.getIDs().length > 0) { idsLoopCounter++; totalIDs += ids.getIDs().length; System.out.println(idsLoopCounter + ": IDS length: " + ids.getIDs().length); JSONObject responseDetailsJson = new JSONObject(); JSONArray jsonArray = new JSONArray(); for (long id : ids.getIDs()) { jsonArray.put(id); } Object idsJSON = responseDetailsJson.put("ids", jsonArray); writer.println(idsJSON); } // If rate limit reached then switch Auth user RemainingCallsCounter++; if (RemainingCallsCounter >= RemainingCalls) { // load auth user tf = AppOAuths.loadOAuthUser(endpoint); twitter = tf.getInstance(); System.out.println("New User Loaded OAuth " + "Screen_name: " + AppOAuths.screen_name); RemainingCalls = AppOAuths.RemainingCalls; RemainingCallsCounter = 0; System.out.println("New Remianing Calls: " + RemainingCalls); } if (IDS_TO_FETCH_INT != -1) { if (idsLoopCounter == IDS_TO_FETCH) { break; } } } while ((cursor = ids.getNextCursor()) != 0); writer.close(); System.out.println("Total ids dumped of " + targetedUser + " are: " + totalIDs); System.out.println(); // update cursor in "followers_parent" String fieldValues = "`nextcursor` = " + cursor; String where = "id = " + followers_parent_id; DB.Update("`followers_parent`", fieldValues, where); } // loop through every result found in db } else { // Second Argument Set, so we are here. System.out.println("screen_name / user_id_str passed by argument"); int idsLoopCounter = 0; int totalIDs = 0; // put idsJSON in a file PrintWriter writer = new PrintWriter( OutputDirPath + "/" + targetedUser + "_ids_" + helpers.getUnixTimeStamp(), "UTF-8"); // call different functions for screen_name and id_str Boolean chckedNumaric = helpers.isNumeric(targetedUser); long cursor = -1; do { ids = null; try { if (chckedNumaric) { long LongValueTargetedUser = Long.valueOf(targetedUser).longValue(); ids = twitter.getFollowersIDs(LongValueTargetedUser, cursor); } else { ids = twitter.getFollowersIDs(targetedUser, cursor); } } catch (TwitterException te) { // do not throw if user has protected tweets, or if they deleted their account if (te.getStatusCode() == HttpResponseCode.UNAUTHORIZED || te.getStatusCode() == HttpResponseCode.NOT_FOUND) { System.out.println(targetedUser + " is protected or account is deleted"); } else { System.out.println("Followers Get Exception: " + te.getMessage()); } System.exit(-1); } if (ids.getIDs().length > 0) { idsLoopCounter++; totalIDs += ids.getIDs().length; System.out.println(idsLoopCounter + ": IDS length: " + ids.getIDs().length); JSONObject responseDetailsJson = new JSONObject(); JSONArray jsonArray = new JSONArray(); for (long id : ids.getIDs()) { jsonArray.put(id); } Object idsJSON = responseDetailsJson.put("ids", jsonArray); writer.println(idsJSON); } // If rate limit reach then switch Auth user RemainingCallsCounter++; if (RemainingCallsCounter >= RemainingCalls) { // load auth user tf = AppOAuths.loadOAuthUser(endpoint); twitter = tf.getInstance(); System.out.println("New User Loaded OAuth Screen_name: " + AppOAuths.screen_name); RemainingCalls = AppOAuths.RemainingCalls; RemainingCallsCounter = 0; System.out.println("New Remianing Calls: " + RemainingCalls); } if (IDS_TO_FETCH_INT != -1) { if (idsLoopCounter == IDS_TO_FETCH) { break; } } } while ((cursor = ids.getNextCursor()) != 0); writer.close(); System.out.println("Total ids dumped of " + targetedUser + " are: " + totalIDs); System.out.println(); } } catch (TwitterException te) { // te.printStackTrace(); System.err.println("Failed to get followers' ids: " + te.getMessage()); System.exit(-1); } System.out.println("!!!! DONE !!!!"); }