@asyncio.coroutine
def get_guild_online(guildname, titlecase=True, tries=5):
    "Returns a guild's world and online member list in a dictionary.\n\n    The dictionary contains the following keys: name, logo_url, world and members.\n    The key members contains a list where each element is a dictionary with the following keys:\n        rank, name, title, vocation, level, joined.\n    Guilds are case sensitive on tibia.com so guildstats.eu is checked for correct case.\n    May return ERROR_DOESNTEXIST or ERROR_NETWORK accordingly."
    gstats_url = ('http://guildstats.eu/guild?guild=' + urllib.parse.quote(guildname))
    guild = {}
    if (not titlecase):
        try:
            page = (yield from aiohttp.get(gstats_url))
            content = (yield from page.text(encoding='ISO-8859-1'))
        except Exception:
            if (tries == 0):
                log.error("getGuildOnline: Couldn't fetch {0} from guildstats.eu, network error.".format(guildname))
                return ERROR_NETWORK
            else:
                tries -= 1
                (yield from asyncio.sleep(network_retry_delay))
                ret = (yield from get_guild_online(guildname, titlecase, tries))
                return ret
        try:
            content.index('<div class="footer">')
        except ValueError:
            if (tries == 0):
                log.error("getGuildOnline: Couldn't fetch {0} from guildstats.eu, network error.".format(guildname))
                return ERROR_NETWORK
            else:
                tries -= 1
                (yield from asyncio.sleep(network_retry_delay))
                ret = (yield from get_guild_online(guildname, titlecase, tries))
                return ret
        if ('<div>Sorry!' in content):
            return ERROR_DOESNTEXIST
        try:
            content.index('General info')
            content.index('Recruitment')
        except Exception:
            log.error('getGuildOnline: -IMPORTANT- guildstats.eu seems to have changed their websites format.')
            return ERROR_NETWORK
        startIndex = content.index('General info')
        endIndex = content.index('Recruitment')
        content = content[startIndex:endIndex]
        m = re.search('<a href="set=(.+?)"', content)
        if m:
            guildname = urllib.parse.unquote_plus(m.group(1))
    else:
        guildname = guildname.title()
    tibia_url = (('https://secure.tibia.com/community/?subtopic=guilds&page=view&GuildName=' + urllib.parse.quote(guildname)) + '&onlyshowonline=1')
    try:
        page = (yield from aiohttp.get(tibia_url))
        content = (yield from page.text(encoding='ISO-8859-1'))
    except Exception:
        if (tries == 0):
            log.error("getGuildOnline: Couldn't fetch {0}, network error.".format(guildname))
            return ERROR_NETWORK
        else:
            tries -= 1
            (yield from asyncio.sleep(network_retry_delay))
            ret = (yield from get_guild_online(guildname, titlecase, tries))
            return ret
    try:
        startIndex = content.index('<div class="BoxContent"')
        endIndex = content.index('<div id="ThemeboxesColumn" >')
        content = content[startIndex:endIndex]
    except ValueError:
        if (tries == 0):
            log.error("getGuildOnline: Couldn't fetch {0}, network error.".format(guildname))
            return ERROR_NETWORK
        else:
            tries -= 1
            (yield from asyncio.sleep(network_retry_delay))
            ret = (yield from get_guild_online(guildname, titlecase, tries))
            return ret
    if ('<div class="Text" >Error</div>' in content):
        if titlecase:
            ret = (yield from get_guild_online(guildname, False))
            return ret
        else:
            return ERROR_DOESNTEXIST
    m = re.search('founded on (\\w+) on ([^.]+)', content)
    if m:
        guild['world'] = m.group(1)
    m = re.search('Their home on \\w+ is ([^\\.]+)', content)
    if m:
        guild['guildhall'] = m.group(1)
    m = re.search('<IMG SRC=\\"([^\\"]+)\\" W', content)
    if m:
        guild['logo_url'] = m.group(1)
    regex_members = '<TR BGCOLOR=#[\\dABCDEF]+><TD>(.+?)</TD>\\s</td><TD><A HREF="https://secure.tibia.com/community/\\?subtopic=characters&name=(.+?)">.+?</A> *\\(*(.*?)\\)*</TD>\\s<TD>(.+?)</TD>\\s<TD>(.+?)</TD>\\s<TD>(.+?)</TD>'
    pattern = re.compile(regex_members, (re.MULTILINE + re.S))
    m = re.findall(pattern, content)
    guild['members'] = []
    if m:
        for (rank, name, title, vocation, level, joined) in m:
            rank = ('' if (rank == '&#160;') else rank)
            name = urllib.parse.unquote_plus(name)
            joined = joined.replace('&#160;', '-')
            guild['members'].append({'rank': rank, 'name': name, 'title': title, 'vocation': vocation, 'level': level, 'joined': joined})
    guild['name'] = guildname
    return guild
Returns a guild's world and online member list in a dictionary.

The dictionary contains the following keys: name, logo_url, world and members.
The key members contains a list where each element is a dictionary with the following keys:
    rank, name, title, vocation, level, joined.
Guilds are case sensitive on tibia.com so guildstats.eu is checked for correct case.
May return ERROR_DOESNTEXIST or ERROR_NETWORK accordingly.
@asyncio.coroutine
def get_guild_online(guildname, titlecase=True, tries=5):
    "Returns a guild's world and online member list in a dictionary.\n\n    The dictionary contains the following keys: name, logo_url, world and members.\n    The key members contains a list where each element is a dictionary with the following keys:\n        rank, name, title, vocation, level, joined.\n    Guilds are case sensitive on tibia.com so guildstats.eu is checked for correct case.\n    May return ERROR_DOESNTEXIST or ERROR_NETWORK accordingly."
    gstats_url = ('http://guildstats.eu/guild?guild=' + urllib.parse.quote(guildname))
    guild = {}
    if (not titlecase):
        try:
            page = (yield from aiohttp.get(gstats_url))
            content = (yield from page.text(encoding='ISO-8859-1'))
        except Exception:
            if (tries == 0):
                log.error("getGuildOnline: Couldn't fetch {0} from guildstats.eu, network error.".format(guildname))
                return ERROR_NETWORK
            else:
                tries -= 1
                (yield from asyncio.sleep(network_retry_delay))
                ret = (yield from get_guild_online(guildname, titlecase, tries))
                return ret
        try:
            content.index('<div class="footer">')
        except ValueError:
            if (tries == 0):
                log.error("getGuildOnline: Couldn't fetch {0} from guildstats.eu, network error.".format(guildname))
                return ERROR_NETWORK
            else:
                tries -= 1
                (yield from asyncio.sleep(network_retry_delay))
                ret = (yield from get_guild_online(guildname, titlecase, tries))
                return ret
        if ('<div>Sorry!' in content):
            return ERROR_DOESNTEXIST
        try:
            content.index('General info')
            content.index('Recruitment')
        except Exception:
            log.error('getGuildOnline: -IMPORTANT- guildstats.eu seems to have changed their websites format.')
            return ERROR_NETWORK
        startIndex = content.index('General info')
        endIndex = content.index('Recruitment')
        content = content[startIndex:endIndex]
        m = re.search('<a href="set=(.+?)"', content)
        if m:
            guildname = urllib.parse.unquote_plus(m.group(1))
    else:
        guildname = guildname.title()
    tibia_url = (('https://secure.tibia.com/community/?subtopic=guilds&page=view&GuildName=' + urllib.parse.quote(guildname)) + '&onlyshowonline=1')
    try:
        page = (yield from aiohttp.get(tibia_url))
        content = (yield from page.text(encoding='ISO-8859-1'))
    except Exception:
        if (tries == 0):
            log.error("getGuildOnline: Couldn't fetch {0}, network error.".format(guildname))
            return ERROR_NETWORK
        else:
            tries -= 1
            (yield from asyncio.sleep(network_retry_delay))
            ret = (yield from get_guild_online(guildname, titlecase, tries))
            return ret
    try:
        startIndex = content.index('<div class="BoxContent"')
        endIndex = content.index('<div id="ThemeboxesColumn" >')
        content = content[startIndex:endIndex]
    except ValueError:
        if (tries == 0):
            log.error("getGuildOnline: Couldn't fetch {0}, network error.".format(guildname))
            return ERROR_NETWORK
        else:
            tries -= 1
            (yield from asyncio.sleep(network_retry_delay))
            ret = (yield from get_guild_online(guildname, titlecase, tries))
            return ret
    if ('<div class="Text" >Error</div>' in content):
        if titlecase:
            ret = (yield from get_guild_online(guildname, False))
            return ret
        else:
            return ERROR_DOESNTEXIST
    m = re.search('founded on (\\w+) on ([^.]+)', content)
    if m:
        guild['world'] = m.group(1)
    m = re.search('Their home on \\w+ is ([^\\.]+)', content)
    if m:
        guild['guildhall'] = m.group(1)
    m = re.search('<IMG SRC=\\"([^\\"]+)\\" W', content)
    if m:
        guild['logo_url'] = m.group(1)
    regex_members = '<TR BGCOLOR=#[\\dABCDEF]+><TD>(.+?)</TD>\\s</td><TD><A HREF="https://secure.tibia.com/community/\\?subtopic=characters&name=(.+?)">.+?</A> *\\(*(.*?)\\)*</TD>\\s<TD>(.+?)</TD>\\s<TD>(.+?)</TD>\\s<TD>(.+?)</TD>'
    pattern = re.compile(regex_members, (re.MULTILINE + re.S))
    m = re.findall(pattern, content)
    guild['members'] = []
    if m:
        for (rank, name, title, vocation, level, joined) in m:
            rank = ( if (rank == '&#160;') else rank)
            name = urllib.parse.unquote_plus(name)
            joined = joined.replace('&#160;', '-')
            guild['members'].append({'rank': rank, 'name': name, 'title': title, 'vocation': vocation, 'level': level, 'joined': joined})
    guild['name'] = guildname
    return guild