I'm trying to merge text element in rlg-item__paint class with text element in rlg-trade__itemshas class, like so:
url = "https://rocket-league.com/trade/465ec00f-2f5c-48e2-831e-2e294683ad56"
response = requests.get(f"{url}")
soup = BeautifulSoup(response.text, "html.parser")
for has in soup.findAll('div', attrs={'class': 'rlg-trade__itemshas'}):
for div in soup.findAll('div', attrs={'class': 'rlg-item-links'}):
div.extract()
for color in soup.findAll('div', attrs={'class': 'rlg-item__paint'}):
color.replaceWith('\n', color)
items = (has.get_text(f"\n"' ', strip=True))
print(items)
but it doesn't work, output:
Magma
Pink
Light Show
Cristiano
Anodized Pearl
Pink text element from rlg-item__paint class, I want to merge it like this:
Magma
Pink Light Show
Cristiano
Anodized Pearl
so I want to merge it in bottom row of text element.