I want to scrape match results from this page: https://www.tennisexplorer.com/player/paire-4a33b/
From the results scraped, I want to create table with columns : tournament, date, match_player_1, match_player_2, round, score I created a code, it work but I can't figure out how to add competition to each match row
import requests
from bs4 import BeautifulSoup
u = 'https://www.tennisexplorer.com/player/paire-4a33b/'
r = requests.get(u, timeout=120, headers=headers)
# print(r.status_code)
soup = BeautifulSoup(r.content, 'html.parser')
for tr in soup.select('#matches-2020-1-data tr'):
match_date = tr.select_one('td:nth-of-type(1)').get_text(strip=True)
match_surface = tr.select_one('td:nth-of-type(2)').get_text(strip=True)
match = tr.select_one('td:nth-of-type(3)').get_text(strip=True)
#...
I need to create table like that:
tournament date match_player_1 match_player_2 round score
Cincinnati Masters (New York) 22.08. Coric B. Paire B. 1R 6-0, 1-0
Ultimate Tennis Showdown 2 01.08. Moutet C. Paire B. NaN 15-0, 15-0, 15-0, 15-0
How I can associate the tournament with each match
