Get countries from Bet365 site using a Raspberry Pi 4 Model B
Budget: €30 – €250 EUR
Get the list of countries from Bet365 web site directly, with Python + Selenium. Having the Python script able to run in a Raspberry Pi 4 Model B and get results with the code below is a must.
The goal is having this code running properly and printing results in a Raspberry Pi 4 Model B (it is already running well in a laptop):
from shutil import which
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
useragent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36"
def get_countries():
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_argument("--disable-blink-features")
options.add_argument("--headless")
#options.add_argument('--no-sandbox')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=which("chromedriver"))
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source":
"const newProto = navigator.__proto__;"
"delete newProto.webdriver;"
"navigator.__proto__ = newProto;"
})
driver.execute_cdp_cmd('Network.setUserAgentOverride', {
"userAgent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/86.0.4240.183 Safari/537.36'})
driver.get("https://www.bet365.es/#/AS/B2/")
wait = WebDriverWait(driver, 10)
wait.until(EC.presence_of_element_located((By.CLASS_NAME, "rsm-MarketGroupButton_Text")))
countries = driver.find_elements_by_class_name("rsm-MarketGroupButton_Text")
for country in countries:
print(country.text)
driver.quit()
if __name__ == '__main__':
get_countries()
The goal is having this code running properly and printing results in a Raspberry Pi 4 Model B (it is already running well in a laptop):
from shutil import which
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
useragent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36"
def get_countries():
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_argument("--disable-blink-features")
options.add_argument("--headless")
#options.add_argument('--no-sandbox')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=which("chromedriver"))
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source":
"const newProto = navigator.__proto__;"
"delete newProto.webdriver;"
"navigator.__proto__ = newProto;"
})
driver.execute_cdp_cmd('Network.setUserAgentOverride', {
"userAgent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/86.0.4240.183 Safari/537.36'})
driver.get("https://www.bet365.es/#/AS/B2/")
wait = WebDriverWait(driver, 10)
wait.until(EC.presence_of_element_located((By.CLASS_NAME, "rsm-MarketGroupButton_Text")))
countries = driver.find_elements_by_class_name("rsm-MarketGroupButton_Text")
for country in countries:
print(country.text)
driver.quit()
if __name__ == '__main__':
get_countries()