Skip to content

Instantly share code, notes, and snippets.

sport_title = box.find_elements_by_class_name('SportTitle-styles-sport')
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()
from selenium import webdriver
import time
#Single row event
single_row_events = grandparent.find_elements_by_class_name('EventRow-styles-event-row')
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)
teams_example = ['Barcelona', 'Madrid', 'Sevilla']
for team in teams_example:
print(team)
teams_example = ['Barcelona', 'Madrid', 'Sevilla']
for team in teams_example:
if team == 'Barcelona':
print(team)
#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)
def find_surebet(odds1, odds2):
sum_odds = (1/odds1) + (1/odds2)
if sum_odds<1:
message = 'Surebet Found!'
else:
message = 'Keep scraping'
return message
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}%'