Fixed stupid unicode issue.

This commit is contained in:
A. Svensson 2015-04-03 12:39:01 +02:00
parent 3a32152fc0
commit cbf209c6b5

View File

@ -51,19 +51,19 @@ class ServerParser(object):
def _parse_server_data(self, data): def _parse_server_data(self, data):
'''Parse the individual parts of each server.''' '''Parse the individual parts of each server.'''
try: try:
title = data.find('b').get_text().splitlines()[0].strip() title = data.find('b').get_text().splitlines()[0].strip().encode('utf-8')
except AttributeError: except AttributeError:
# HACK: I think this happends because the raw data was incomplete. # HACK: I think this happends because the raw data was incomplete.
# No complete data, no server update. # No complete data, no server update.
return None return None
game_url = data.find('span', 'smaller').text game_url = data.find('span', 'smaller').text.encode('utf-8')
tmp = data.find('a') tmp = data.find('a')
site_url = None site_url = None
# Default means the server hasn't set a custom site url # Default means the server hasn't set a custom site url
if tmp and not tmp.text == 'Default': if tmp and not tmp.text == 'Default':
try: try:
site_url = tmp['href'] site_url = tmp['href'].encode('utf-8')
# Handle some funky servers... # Handle some funky servers...
if site_url == 'http://': if site_url == 'http://':
site_url = '' site_url = ''