diff --git a/modules/tweets/__init__.py b/modules/tweets/__init__.py index 314bd4e2..21ba4910 100644 --- a/modules/tweets/__init__.py +++ b/modules/tweets/__init__.py @@ -166,7 +166,8 @@ class Module(ModuleManager.BaseModule): tweet = self._from_username(target) if tweet: - tweet_str = format._tweet(self.exports, event["server"], tweet) + tweet_str = format._tweet(self.exports, event["server"], tweet, + from_url=not url_match==None) event["stdout"].write(tweet_str) else: event["stderr"].write("Invalid tweet identifiers provided") @@ -183,6 +184,7 @@ class Module(ModuleManager.BaseModule): tweet_id = event["match"].group(1) tweet = self._from_id(tweet_id) if tweet: - tweet_str = format._tweet(self.exports, event["server"], tweet) + tweet_str = format._tweet(self.exports, event["server"], tweet, + from_url=True) event["stdout"].write(tweet_str) diff --git a/modules/tweets/format.py b/modules/tweets/format.py index af6dfbbb..0a4926e4 100644 --- a/modules/tweets/format.py +++ b/modules/tweets/format.py @@ -6,7 +6,7 @@ def _timestamp(dt): since, unit = utils.time_unit(seconds_since) return "%s %s ago" % (since, unit) -def _tweet(exports, server, tweet): +def _tweet(exports, server, tweet, from_url): linked_id = tweet.id username = tweet.user.screen_name @@ -17,8 +17,10 @@ def _tweet(exports, server, tweet): tweet_link = "https://twitter.com/%s/status/%s" % (username, linked_id) - short_url = exports.get_one("shorturl")(server, tweet_link) - short_url = " - %s" % short_url if short_url else "" + short_url = "" + if not from_url: + short_url = exports.get_one("shorturl")(server, tweet_link) + short_url = " - %s" % short_url if short_url else "" created_at = _timestamp(tweet.created_at) # having to use hasattr here is nasty.