I want to get tweets by particular user by entering its userId
.
I can search for a text by:
Query query = new Query("Hi");
QueryResult result;
do {
result = twitter.search(query);
List<Status> tweets = result.getTweets();
for (Status tweet : tweets) {
System.out.println("@" + tweet.getUser().getScreenName() +
" - " + tweet.getText());
}
} while ((query = result.nextQuery()) != null);
but how can I search for the tweets by entering particular userId
, is there any direct method or I have to apply logic ?
I am trying:
Status status = twitter.showStatus(id);
if (status != null){
System.out.println("@" + status.getUser().getScreenName()
+ " - " + status.getText());}
where id is userId, but by doing this, I am getting the error:
Failed to search tweets: 404:The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method. message - No status found with that ID. code - 144
Can anyone please help me with this?