From 3d3abc90e114ffa2abe05cb52f9ff50c73608fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Thu, 20 Aug 2015 17:57:06 -0500 Subject: [PATCH] Expanded URL are displayed in the view tweet dialogue --- src/controller/buffersController.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/controller/buffersController.py b/src/controller/buffersController.py index 496b7279..77dfde81 100644 --- a/src/controller/buffersController.py +++ b/src/controller/buffersController.py @@ -235,6 +235,10 @@ class baseBufferController(bufferController): uri = tweet["long_uri"] try: tweet = self.session.twitter.twitter.show_status(id=tweet_id) + urls = utils.find_urls_in_text(tweet["text"]) + for url in range(0, len(urls)): + try: tweet["text"] = tweet["text"].replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"]) + except IndexError: pass except TwythonError as e: utils.twitter_error(e) return @@ -246,6 +250,10 @@ class baseBufferController(bufferController): id = tweets.get_id(l) try: tweet = self.session.twitter.twitter.show_status(id=id) + urls = utils.find_urls_in_text(tweet["text"]) + for url in range(0, len(urls)): + try: tweet["text"] = tweet["text"].replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"]) + except IndexError: pass except TwythonError as e: utils.twitter_error(e) return