Twitter4j Status Problem

twitter4j
java

#1

Hello, for my master project i downloaded nearly 12millions of tweets through twitter4j api from april up to now with lat - long and language dependent. But at the begining of everything i made a mistake. The mistake is that i defined tweetCreatedTime column as DateTime and when i was listening to twitter stream i inserted time as java.sql.date which makes date like 2016-03-30 00:00:00 so that means i dont have hours and seconds. To fix my mistake i thought to update all records in table, because i have id’s of tweets so i thought i can get created time of each tweet one by one and can update via tweet id. However i have some problems in my code , therefore i need some ticks and helps. Thank you very much…

When i debug my code i faced with a problem in the following part of code.

while (rs.next()) {
		String tweetId = rs.getString("tweetId");
		status = twitter.showStatus(Long.parseLong(tweetId));
		Timestamp ts = new Timestamp(status.getCreatedAt().getTime());
		count++;
		try {
			result = updateTime(tweetId, ts);
			if (result) {
				System.out.println("Update is Successfull!");
				System.out.println("------------------");
                           }else{System.out.println("No result");}
				} catch (Exception ex) {
					ex.getMessage();
				}

In the following part i m getting tweet id’s from database one by one and then trying to get status of user.
String tweetId = rs.getString(“tweetId”);
status = twitter.showStatus(Long.parseLong(tweetId));
But it only updates the first element of result set then exiting from the while statement. so i have problem in running of this statement (status = twitter.showStatus(Long.parseLong(tweetId));)


#2

Thank you very much for your interest. I put try block before the initialization of status so the problem is solved :slight_smile: but it is too slow , is there any way to make it faster ? It think the twitter.showStatus(Long.parseLong(tweetId)); puts some delay to work. How can i escape from waiting? because it gives me about 130 tweets per 15 minute, so with this way the 12millions of tweet could not be update in a few hours.
Thank you for your interest.:wink:


#3

@andypiper can you check that problem for me ? İ have sent an email to you.


#4

Unfortunately I’m not able to individually fix every code issue that gets posted here - you may want to seek help from the broader Twitter4J community. You’ll certainly hit rate limits with the method you’ve chosen, and this process may well take you a long time to complete with that volume of data.