Posts from twitter are displayed properly
This commit is contained in:
parent
eaa70ef818
commit
7818207908
@ -6,7 +6,7 @@ import sys
|
|||||||
|
|
||||||
APP_LOG_FILE = 'debug.log'
|
APP_LOG_FILE = 'debug.log'
|
||||||
ERROR_LOG_FILE = "error.log"
|
ERROR_LOG_FILE = "error.log"
|
||||||
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
|
MESSAGE_FORMAT = u"%(asctime)s %(name)s %(levelname)s: %(message)s"
|
||||||
DATE_FORMAT = u"%d/%m/%Y %H:%M:%S"
|
DATE_FORMAT = u"%d/%m/%Y %H:%M:%S"
|
||||||
|
|
||||||
formatter = logging.Formatter(MESSAGE_FORMAT.decode("utf-8"), datefmt=DATE_FORMAT)
|
formatter = logging.Formatter(MESSAGE_FORMAT.decode("utf-8"), datefmt=DATE_FORMAT)
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
|
import logging
|
||||||
|
log = logging.getLogger("utils")
|
||||||
url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*")
|
url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*")
|
||||||
bad_chars = '\'\\.,[](){}:;"'
|
bad_chars = '\'\\.,[](){}:;"'
|
||||||
|
|
||||||
@ -56,4 +57,5 @@ def download_file(url, local_filename, window):
|
|||||||
def clean_text(text):
|
def clean_text(text):
|
||||||
""" Replaces all HTML entities and put the plain text equivalent if it's possible."""
|
""" Replaces all HTML entities and put the plain text equivalent if it's possible."""
|
||||||
text = text.replace("<br>", "\n")
|
text = text.replace("<br>", "\n")
|
||||||
|
text = text.replace("\\n", "\n")
|
||||||
return text
|
return text
|
Loading…
Reference in New Issue
Block a user