Status original = status.getRetweetedStatus(); theMap.put("retweet_count", original.getRetweetCount());
List<Status> retweets = twitter.getRetweetedByMe(); for (Status retweet : retweets) { if(retweet.getRetweetedStatus().getId() == ID_OF_TWEET_YOU_DONT_WANT_TO_RETWEET_ANYMORE) twitter.destroyStatus(retweet.getId()); }
ResponseList<Status> tweets = twitter.getHomeTimeline(); for(Status s : tweets){ Tweet temp; if(s.isRetweet()){ temp = new Tweet(s.getRetweetedStatus(),s.getUser().getName()); } else{ temp = new Tweet(s); } tweetsPanel.add(temp); tweetsPanel.add(Box.createRigidArea(new Dimension(0,2))); }
@Override public List<Object> filter(Status original) { Status status = original.getRetweetedStatus(); if (status == null) { return null; } if(status.getRetweetCount() < retweetCount) { return null; } //Just tweets two days old if(status.getCreatedAt().getTime() + 2*24*60*60*1000 < System.currentTimeMillis()) { return null; } JSONObject msg = new JSONObject(); msg.put("user", original.getUser().getScreenName()); msg.put("photo", original.getUser().getProfileImageURL().toString()); msg.put("tweet", original.getText()); msg.put("id", original.getId()); //msg.put("count", status.getRetweetCount() > 100 ? "> 100" : status.getRetweetCount()); msg.put("count", status.getRetweetCount()); publish(msg.toJSONString()); List<Object> result = new ArrayList<Object>(); result.add(status); return result; }
public static Notification fromRetweet(final Status retweetingStatus) { final String title = retweetingStatus.getUser().getName() + " retweeted you"; return new Notification(title, retweetingStatus.getRetweetedStatus().getText()); }
Status original = status.getRetweetedStatus(); theMap.put("retweet_count", original.getRetweetCount());
/** * Determines whether a given tweet is a retweet made by the current user. Twitter's API really is unhelpful on this * side so we mostly take an educated guess here, although it should be enough in most cases. * * @param status the tweet to test against * * @return true if and only if the given status is a retweet made by the current user */ public boolean isRetweetByCurrentUser(final Status status) { if (status.isRetweet()) { final Status retweetedStatus = status.getRetweetedStatus(); return retweetedStatus.isRetweeted() || retweetedStatus.isRetweetedByMe() || sessionManager.isCurrentUser(status.getUser()); } else { return false; } }
/** * Handles retweets so as to add retweet info at the top and then display the actual underlying status. */ private void handleRetweet(final Status status) { retweeterLabel.setText(status.getUser().getName()); retweeterIdLabel.setText("@" + status.getUser().getScreenName()); setStatusDisplay(status.getRetweetedStatus()); }
/** * Checks whether a given tweet has been retweeted by the current user. * <p> * PSA : I don't care that you can retweet your own tweets. This is stupid and you should never do it. Will never * allow a PR "fixing" that pass. * * @param tweet the tweet to check * * @return Whether the given tweet had not yet been retweeted by the current user. */ public boolean notYetRetweeted(final Status tweet) { return !sessionManager.doWithCurrentTwitter(twitter -> { final Status updatedTweet = twitter.showStatus(tweet.getId()); final Status originalStatus = updatedTweet.isRetweet() ? updatedTweet.getRetweetedStatus() : updatedTweet; return originalStatus.isRetweeted(); }).get(); }
/** * Unretweets (deletes the retweet-created tweet for the current user. See {@link #retweet(Status)} for explanation * on that). * * @param tweet the tweet to unretweet * * @return The retweet that was deleted */ Status unretweet(final Status tweet) { final Status original = tweet.isRetweet() ? tweet.getRetweetedStatus() : tweet; return sessionManager.doWithCurrentTwitter( twitter -> twitter.unRetweetStatus(original.getId()) ).onSuccess(resultingStatus -> LOG.debug( "User {} unretweeted tweet {}", getCurrentScreenName(), resultingStatus.getId() )).onFailure(err -> displayExceptionPane( "Could not unretweet tweet!", err.getMessage(), err )).get(); }
long userId = status.getUser().getId(); long tweetId = status.getId(); long resolvedTweetId = status.isRetweet() ? status.getRetweetedStatus().getId() : status.getId(); HashtagEntity[] hashtagEntities = status.getHashtagEntities();
@Override public void initialize() { setUpInteractionActions(); targetStatus.addListener((o, prev, cur) -> { updateRetweetVisual(cur.isRetweet() ? cur.getRetweetedStatus().isRetweeted() : cur.isRetweeted()); updateLikeVisual(cur.isFavorited()); }); }
/** * Called on click of the retweet button. * <p> * Will call {@link #updateRetweetVisual(boolean)} on task finish to set the appropriate visual value. * * @see TwitterInteractionService * @see TwitterBinaryInteraction * @see StatusInteraction#RETWEET */ private void onRetweet() { LOG.debug("Retweet interaction on status {}", targetStatus.getValue().getId()); retweetButton.setDisable(true); CompletableFuture.supplyAsync( () -> interactionService.interact(targetStatus.getValue(), RETWEET) ).thenAcceptAsync(res -> { final Status originalStatus = targetStatus.getValue().isRetweet() ? targetStatus.getValue().getRetweetedStatus() : targetStatus.getValue(); updateRetweetVisual(!interactionService.notYetRetweeted(originalStatus)); retweetButton.setDisable(false); }, Platform::runLater); }
@Override public void onStatus(Status status) { Document tweet = new Document(); tweet.put("_id", status.getId()); tweet.put("createdAt", status.getCreatedAt()); tweet.put("favoriteCount", status.getFavoriteCount()); tweet.put("retweetCount", status.getRetweetCount()); if (status.getGeoLocation() != null) { tweet.put("lat", status.getGeoLocation().getLatitude()); tweet.put("long", status.getGeoLocation().getLongitude()); } tweet.put("screenName", status.getUser().getScreenName()); if (status.getRetweetedStatus() != null) { tweet.put("retweetedStatus", status.getRetweetedStatus().getText()); } tweet.put("text", status.getText()); Document query = new Document(); query.put("_id", status.getId()); collection.replaceOne(query, tweet, new UpdateOptions().upsert(true)); }
Status retweeted = tweet.getRetweetedStatus(); if (retweeted != null) { extractRetweetedAccounts(tweet, contents, retweeted);