I want to scrape the opening odds of a certain bookmaker from this website: https://www.betexplorer.com/match-odds/4YWZmAJt/1/1x2/ So I have this function:
def get_odds(ids):
for id in ids:
url = f'https://www.betexplorer.com{id}'
matchup = url.split('/')[6]
match_id = url.split('/')[7] # <-- this is the last part of URL
api_url = "https://www.betexplorer.com/match-odds/{}/1/1x2/".format(match_id)
headers = {"Referer": "https://www.betexplorer.com",
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36'}
s = requests.Session()
s.headers.update(headers)
response = s.get(api_url, headers=headers)
soup = BeautifulSoup(response.text,'html.parser')
print(soup)
ids is a list, with this kind of strings
ids=['/soccer/argentina/primera-division-2016/gimnasia-l-p-colon-santa-fe/4YWZmAJt/']
I want to find by the name of a bookmaker and scrape his data-opening-odd
