def scrape(): latest_transactions_page = TransactionScraper.BROWSER.get(TransactionScraper.LATEST_TRANSACTIONS_URL) transactions_heading = latest_transactions_page.soup.find_all('h2', string="Tapahtumat")[0] transactions_table = transactions_heading.parent.table transaction_rows = [row for row in transactions_table.descendants if TransactionScraper.is_transaction_row(row)] return [TransactionParser.from_row(row) for row in transaction_rows]
def is_transaction_row(element): return element.name == 'tr' and TransactionParser.is_transaction_row(element)