Shosetsu/Parsing.py
async def parse_character_results(soup):
    """
    Parse a page of character results.

    :param soup: The BS4 class object
    :return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
             for games they appeared in.
    """
    soup = list(soup.find_all('table', class_='stripe')[0].children)[1:]
    characters = []
    for item in soup:
        temp_c = {'gender': None, 'name': None, 'games': {}}
        temp_c['gender'] = item.abbr.get('title')
        temp_c['name'] = list(item.children)[1].a.string
        temp_c['games'] = []
        for game in list(list(list(item.children)[1].children)[1].children):
            if isinstance(game, NavigableString):
                continue
            temp_c['games'].append({'name': game.string, 'id': game.get('href').split('/')[1]})
        characters.append(temp_c)
        del temp_c
    return characters
async def parse_character_results(soup):
    """
    Parse a page of character results.

    :param soup: The BS4 class object
    :return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
             for games they appeared in.
    """
    soup = list(soup.find_all('table', class_='stripe')[0].children)[1:]
    characters = []
    for item in soup:
        temp_c = {'gender': None, 'name': None, 'games': {}}
        temp_c['gender'] = item.abbr.get('title')
        temp_c['name'] = list(item.children)[1].a.string
        temp_c['games'] = []
        for game in list(list(list(item.children)[1].children)[1].children):
            if isinstance(game, NavigableString):
                continue
            temp_c['games'].append({'name': game.string, 'id': game.get('href').split('/')[1]})
        characters.append(temp_c)
        del temp_c
    return characters
async def parse_character_results ( soup ) : soup = list ( soup . find_all ( 'table' , class_ = 'stripe' ) [ 0 ] . children ) [ 1 : ] characters = [ ] for item in soup : temp_c = { 'gender' : None , 'name' : None , 'games' : { } } temp_c [ 'gender' ] = item . abbr . get ( 'title' ) temp_c [ 'name' ] = list ( item . children ) [ 1 ] . a . string temp_c [ 'games' ] = [ ] for game in list ( list ( list ( item . children ) [ 1 ] . children ) [ 1 ] . children ) : if isinstance ( game , NavigableString ) : continue temp_c [ 'games' ] . append ( { 'name' : game . string , 'id' : game . get ( 'href' ) . split ( '/' ) [ 1 ] } ) characters . append ( temp_c ) del temp_c return characters
Parse a page of character results.

    :param soup: The BS4 class object
    :return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
             for games they appeared in.
Parse a page of character results .