This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sport_title = box.find_elements_by_class_name('SportTitle-styles-sport') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for odds_event in odds_events: | |
| for n, box in enumerate(odds_event): | |
| rows = box.find_elements_by_xpath('.//*') | |
| if n == 0: | |
| x12.append(rows[0].text) | |
| driver.quit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from selenium import webdriver | |
| import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Single row event | |
| single_row_events = grandparent.find_elements_by_class_name('EventRow-styles-event-row') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for match in single_row_events: | |
| odds_event = match.find_elements_by_class_name('EventOddGroup-styles-odd-groups') | |
| odds_events.append(odds_event) | |
| # teams | |
| for team in match.find_elements_by_class_name('EventTeams-styles-titles'): | |
| teams.append(team.text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| teams_example = ['Barcelona', 'Madrid', 'Sevilla'] | |
| for team in teams_example: | |
| print(team) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| teams_example = ['Barcelona', 'Madrid', 'Sevilla'] | |
| for team in teams_example: | |
| if team == 'Barcelona': | |
| print(team) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Import Selenium | |
| from selenium import webdriver | |
| import pandas as pd | |
| import time | |
| #Writing our First Selenium Python Test | |
| web = 'https://sports.tipico.de/en/all/football/spain/la-liga' #you can choose any other league (update 1) | |
| path = '/Users/.../chromedriver' | |
| driver = webdriver.Chrome(path) | |
| driver.get(web) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_surebet(odds1, odds2): | |
| sum_odds = (1/odds1) + (1/odds2) | |
| if sum_odds<1: | |
| message = 'Surebet Found!' | |
| else: | |
| message = 'Keep scraping' | |
| return message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sympy import symbols, Eq, solve | |
| def beat_bookies(odds1, odds2, total_stake): | |
| x, y = symbols('x y') | |
| eq1 = Eq(x + y - total_stake, 0) # total_stake = x + y | |
| eq2 = Eq((odds2*y) - odds1*x, 0) # odds1*x = odds2*y | |
| stakes = solve((eq1,eq2), (x, y)) | |
| total_investment = stakes[x] + stakes[y] | |
| profit1 = odds1*stakes[x] - total_stake | |
| profit2 = odds2*stakes[y] - total_stake | |
| benefit1 = f'{profit1 / total_investment * 100:.2f}%' |