etc/roster_scraper.py
def _extract_page_content(self, content):
        """
        INPUT: String
        RETURN: List of list of strings

        Take in string of HTML content. Find table of player data, parse each td
        element for individual player data. Return list of player data.

        """
        data = None
        soup = bs4.BeautifulSoup(content, 'html.parser')
        table = soup.find('div',
                         class_=re.compile('wisbb_playersTable'))

        if table:
            rows = table.find("tbody").findAll("tr")

            # get raw strings for content of each td
            num_pos = [[el.text.strip() for el in row.findAll("td")[2:4]] for row in rows]
            raw_name = [[el.find("span").text.strip() for el in row.findAll("td")[:1]] for row in rows]
            team = [[el.text.strip() for el in row.findAll("td")[1:2]][0] for row in rows]

            # split num_pos
            number = [el[0] for el in num_pos]
            position = [el[1] for el in num_pos]

            # split raw_name
            names = [el[0].split() for el in raw_name]
            first = [name[0].strip(' ,') for name in names]
            last = [name[1].strip(' ,') for name in names]

            # concatenate data
            data = zip(first, last, team, number, position)

        return data

        INPUT: String
        RETURN: List of list of strings

        Take in string of HTML content. Find table of player data, parse each td
        element for individual player data. Return list of player data.

        
String
RETURN: List of list of strings

Take in string of HTML content. Find table of player data, parse each td
element for individual player data. Return list of player data.
String RETURN : List of list of strings Take in string of HTML content . Find table of player data parse each td element for individual player data . Return list of player data .
def _extract_page_content(self, content):
        data = None
        soup = bs4.BeautifulSoup(content, 'html.parser')
        table = soup.find('div',
                         class_=re.compile('wisbb_playersTable'))
        if table:
            rows = table.find("tbody").findAll("tr")
            num_pos = [[el.text.strip() for el in row.findAll("td")[2:4]] for row in rows]
            raw_name = [[el.find("span").text.strip() for el in row.findAll("td")[:1]] for row in rows]
            team = [[el.text.strip() for el in row.findAll("td")[1:2]][0] for row in rows]
            number = [el[0] for el in num_pos]
            position = [el[1] for el in num_pos]
            names = [el[0].split() for el in raw_name]
            first = [name[0].strip(' ,') for name in names]
            last = [name[1].strip(' ,') for name in names]
            data = zip(first, last, team, number, position)
        return data
def _extract_page_content ( self , content ) : data = None soup = bs4 . BeautifulSoup ( content , 'html.parser' ) table = soup . find ( 'div' , class_ = re . compile ( 'wisbb_playersTable' ) ) if table : rows = table . find ( "tbody" ) . findAll ( "tr" ) num_pos = [ [ el . text . strip ( ) for el in row . findAll ( "td" ) [ 2 : 4 ] ] for row in rows ] raw_name = [ [ el . find ( "span" ) . text . strip ( ) for el in row . findAll ( "td" ) [ : 1 ] ] for row in rows ] team = [ [ el . text . strip ( ) for el in row . findAll ( "td" ) [ 1 : 2 ] ] [ 0 ] for row in rows ] number = [ el [ 0 ] for el in num_pos ] position = [ el [ 1 ] for el in num_pos ] names = [ el [ 0 ] . split ( ) for el in raw_name ] first = [ name [ 0 ] . strip ( ' ,' ) for name in names ] last = [ name [ 1 ] . strip ( ' ,' ) for name in names ] data = zip ( first , last , team , number , position ) return data
INPUT: String
RETURN: List of list of strings
INPUT : String RETURN : List of list of strings
"""
        INPUT: String
        RETURN: List of list of strings

        Take in string of HTML content. Find table of player data, parse each td
        element for individual player data. Return list of player data.

        """ # get raw strings for content of each td # split num_pos # split raw_name # concatenate data
self
content