Is there a way to extract only specific user who post a tweet when using TwitterUtils.createStream()? (JAVA) The "filters" argument specifies the strings that need to be contained in the tweets, but I am not sure how this can be used to specify the user who interest me. i have this :
String[] filters = { "#USA" };
JavaDStream<Status> tweets = TwitterUtils.createStream(ssc,filters);
this give me tweets which contains "#USA" what i need is a way to listen to a specific user and see what he post .
thanks
private void receive() {
try {
TwitterStream newTwitterStream = new TwitterStreamFactory()
.getInstance(twitterAuth);
newTwitterStream.addListener(new StatusListener() {
public void onException(Exception e) {
if (!arret) {
restart("Erreur pandant la reception des tweets", e);
}
}
public void onTrackLimitationNotice(int arg0) {
// TODO Auto-generated method stub
}
public void onStatus(Status status) {
store(status);
}
public void onStallWarning(StallWarning arg0) {
// TODO Auto-generated method stub
}
public void onScrubGeo(long arg0, long arg1) {
// TODO Auto-generated method stub
}
public void onDeletionNotice(StatusDeletionNotice arg0) {
// TODO Auto-generated method stub
}
});
FilterQuery query = new FilterQuery();
if (filter_mots.length > 0 || filter_utilisateurs.length >0) {
if (filter_mots.length > 0){
query.track(filter_mots);
}
if (filter_utilisateurs.length >0){
query.follow(filter_utilisateurs);
}
newTwitterStream.filter(query);
} else{
newTwitterStream.sample();
}
setTwitterStream(newTwitterStream) ;
arret = false ;
} catch (Throwable t) {
// En cas d'erreur on redémare le streaming
restart("Erreur pendant la reception des données ", t);
}
}