suggest fix for #20
authorOrakaro <nhatminh_179@hotmail.com>
Sun, 20 Jul 2014 01:56:50 +0000 (10:56 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Sun, 20 Jul 2014 01:56:50 +0000 (10:56 +0900)
rainbowstream/draw.py
rainbowstream/py3patch.py

index f23e4ca..4360d46 100644 (file)
@@ -20,11 +20,6 @@ db = RainbowDB()
 g = {}
 
 
 g = {}
 
 
-def unescape(s):
-    p = HTMLParser()
-    return p.unescape(s)
-
-
 def init_cycle():
     """
     Init the cycle
 def init_cycle():
     """
     Init the cycle
@@ -163,11 +158,12 @@ def draw(t, iot=False, keyword=None, check_semaphore=False, fil=[], ig=[]):
 
     # Pull extended retweet text
     try:
 
     # Pull extended retweet text
     try:
-        text = 'RT @{0}: {1}'.format(t['retweeted_status']['user']['screen_name'],
-                                     t['retweeted_status']['text'])
+        text = 'RT @' + t['retweeted_status']['user']['screen_name'] + ': ' +\
+            t['retweeted_status']['text']
     except:
         pass
 
     except:
         pass
 
+    # Unescape HTML character
     text = unescape(text)
 
     # Get expanded url
     text = unescape(text)
 
     # Get expanded url
index 6042984..83e5f0a 100644 (file)
@@ -13,8 +13,11 @@ except:
 
 try:
     from HTMLParser import HTMLParser
 
 try:
     from HTMLParser import HTMLParser
+    def unescape(s):
+        p = HTMLParser()
+        return p.unescape(s)
 except:
 except:
-    from html.parser import HTMLParser
+    from html import unescape
 
 # raw_input and map functiion behaviour
 if sys.version[0] == "3":
 
 # raw_input and map functiion behaviour
 if sys.version[0] == "3":