From: Orakaro Date: Sun, 20 Jul 2014 01:56:50 +0000 (+0900) Subject: suggest fix for #20 X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=commitdiff_plain;h=18df6e7fa892cf85dda074a7044ce586ecf17c77 suggest fix for #20 --- diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index f23e4ca..4360d46 100644 --- a/rainbowstream/draw.py +++ b/rainbowstream/draw.py @@ -20,11 +20,6 @@ db = RainbowDB() g = {} -def unescape(s): - p = HTMLParser() - return p.unescape(s) - - 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: - 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 + # Unescape HTML character text = unescape(text) # Get expanded url diff --git a/rainbowstream/py3patch.py b/rainbowstream/py3patch.py index 6042984..83e5f0a 100644 --- a/rainbowstream/py3patch.py +++ b/rainbowstream/py3patch.py @@ -13,8 +13,11 @@ except: try: from HTMLParser import HTMLParser + def unescape(s): + p = HTMLParser() + return p.unescape(s) except: - from html.parser import HTMLParser + from html import unescape # raw_input and map functiion behaviour if sys.version[0] == "3":