// create the twitter stream factory with the config
TwitterStreamFactory fact =
new TwitterStreamFactory(config.build());
// get an instance of twitter stream
twitterStream = fact.getInstance();
FilterQuery tweetFilterQuery = new FilterQuery(); // See
tweetFilterQuery.locations(new double[][]{new double[] {-124.848974,24.396308},
new double[]{-66.885444,49.384358
}});
tweetFilterQuery.language(new String[]{"en"});
tweetFilterQuery.track(new String[]{"sony", "apple" });
// provide the handler for twitter stream
twitterStream.addListener(new TweetListener());
twitterStream.filter(tweetFilterQuery);
// start the sampling of tweets
//twitterStream.sample();
在twitter spout中,我只想要有apple或sony字样的tweet,我试过tweetfilterquery.track()。我只需要推特,其中包含索尼和苹果的话。
暂无答案!
目前还没有任何答案,快来回答吧!