I'm practicing scraping using a real-estate website, and I want to scrape all addresses for recent sales. For example, the part of the website HTML looks like this: url = https://www.compass.com/agents/irene-vuong/
<div class="profile-active-listings" role="tabpanel" id="active-listings-sales">
<div class="card-content">
<a class="card-title" href="/listing" data-tn="label-address"> 111 East 35th </a>
........
<div class="textIntent-headline1"> Recent Sales</div>
<div class="card-content">
<a class="card-title" href="/morelisting" data-tn="label-address"> East 4th </a>
And I'm trying to get access to all address, using below code:
for i in range(0, 30):
h = soup.findAll('a', {'class':'card-title'})[i]
print(h)
However, I get an error of:
IndexError: list index out of range
I get the first few addresses, but only right before "Recent Sales". It's only getting addresses on the first part but not the entire website. How do I get all addresses?