From e1d51be9b1042f2f5b7cc58dedad7aab2c69aaf7 Mon Sep 17 00:00:00 2001 From: Michael Winsauer Date: Tue, 11 Dec 2018 14:31:12 +0100 Subject: [PATCH] Exclude retweets via query string See https://www.followthehashtag.com/help/hidden-twitter-search-operators-extra-power-followthehashtag/ --- .../at/aic18/g6t4/servicetwitter/service/TwitterService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service-twitter/src/main/java/at/aic18/g6t4/servicetwitter/service/TwitterService.java b/service-twitter/src/main/java/at/aic18/g6t4/servicetwitter/service/TwitterService.java index d676835..f10c2dc 100644 --- a/service-twitter/src/main/java/at/aic18/g6t4/servicetwitter/service/TwitterService.java +++ b/service-twitter/src/main/java/at/aic18/g6t4/servicetwitter/service/TwitterService.java @@ -18,7 +18,8 @@ public class TwitterService { } public List searchTweets(String queryString) throws TwitterException { - Query query = new Query(queryString); + String excludeRetweets = " exclude:retweets"; + Query query = new Query(queryString + excludeRetweets); query.count(10); QueryResult queryResult = twitter.search(query); List statusList = queryResult.getTweets(); -- 2.43.0