def get_our_score(board_tag: bs4.element.Tag) -> str: board_tables = board_tag.findChild('tbody').find('tr').find('td').find_all('table') our_result_rows = board_tables[2].find_all('tr') our_score_tag = our_result_rows[1].find_all('td')[1] score_string = get_clean_text_with_img_replaced_by_alt(our_score_tag) return score_string
def get_board_id(board_tag: bs4.element.Tag) -> str: result = board_tag.findChild('th', {'class': 'boardheaderleft'}).text result = result.replace('\n', '').replace(' ', ' ').strip() return result
def get_our_result(board_tag: bs4.element.Tag) -> str: board_tables = board_tag.findChild('tbody').find('tr').find('td').find_all('table') our_result_rows = board_tables[2].find_all('tr') our_contract_points_tag = our_result_rows[0].find_all('td')[1] result_string = get_clean_text_with_img_replaced_by_alt(our_contract_points_tag) return result_string
def get_clean_text_with_img_replaced_by_alt(tag: bs4.element.Tag) -> str: if tag.findChild('img'): suit = tag.find('img').get('alt') tag.find('img').replace_with(suit) return tag.text.replace('\n', '').strip()