Open SoloHombs opened 4 months ago
`import requests from bs4 import BeautifulSoup import pandas as pd url='https://www.residential.com/homesearch/for_rent/CA/Los_Angeles' response=requests.get(url)
html=response.text
soup=BeautifulSoup(html,'html.parser')
accomodation=soup.find('div',{'class':'container_listingsListcLFTb'})
home=accomodation.find_all('a',{'class':'listing_listings6sYv'})
Rental=[]
for house in home:
price=house.find('div',{'class':'listing_priceBtsti'}).text.strip()
area=house.find('div',{'class':'listing_details__D3EEd'}).text.strip()
adress=house.find('div',{'class':'listing_addressXntl0'}).text.strip()
name=[]
try:
n=house.find_all('div',{'class':'agent-source_name__iAwOO'})[0]
name.append(n.text[13:].strip())
except:
name.append('Agent info not found')
for N in name:
namy=N
Rental.append([namy,adress,area,price])
Home=pd.DataFrame(Rental,columns=['Name','Adress','Residential information','Price'])
Home.to_csv('C:/Users/DELL/Desktop/Webdriver/Rental Houses.csv',index=False)
`
Real Estate and PDF Webscraping [Uploading Web Scraping Sample projects.pdf…]()