Q:

Scrape text under br tag under class

I've been trying to scrape addresses in this page:
https://www.yellowpages.my/listing/results.php?keyword=boutique&where=selangor&screen=2
It is difficult for me to get the address under the br tag:enter image description here
What i've tried

addresses = page_content.select(' .cbp-vm-address')[0]
address = addresses.get_text(' ', strip=True)
address = list(addresses.stripped_strings)

which doesn't give me everything under the class
i've also tried:

for br in page_content.findAll('br'):
   item = br.next_siblings
   item = list(item)
   print(item)

which gives me results as below (snippet):
[<br/>, <br/>, <br/>, <br/>, <br/>, '\n', <a href="/solutions">DigitalSolutions</a>, '\n', <a href="https://www.yellowpages.my/deal/results.php">Deals</a>, '\n', <a class="sign-up" href="https://www.yellowpages.my/profile/add.php">Sign Up</a>, '\n', <a class="sign-up" href="https://www.yellowpages.my/profile/login.php">Login</a>, '\n']
How do i get the address? relatively new to scraping here.

A:

Thanks Ohad for the quick response. I just want to slightly improve the answer below:
import requests
from bs4 import BeautifulSoup

raw = requests.get("https://www.yellowpages.my/listing/results.php?keyword=boutique&where=selangor&screen=2")
# raw = raw.replace("</br>", "") # try not to do this
soup = BeautifulSoup(raw.content, "lxml") # instead, change "html.parser" to "lxml"
addresses = [x.text.strip().split("\r\n")[-1].strip() for x in soup.find_all("div", class_="cbp-vm-address")]

