Fixed name and address
Now prints out name and address of located apartments
This commit is contained in:
@@ -3,12 +3,12 @@ import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
|
||||
|
||||
#list of Cities
|
||||
Cities =["Dallas","Fort Worth","Arlington","Plano","Irving","Denton","Richardson","Grapevine"]
|
||||
St="tx"
|
||||
baseurl="https://www.apartments.com/" #baseURL
|
||||
search ="/max-2-bedrooms-under-1500" #search terms
|
||||
#driver = webdriver.Chrome()
|
||||
driver = webdriver.Edge()
|
||||
x=0
|
||||
#url = baseurl+'Dallas'+"-"+St+search
|
||||
@@ -26,8 +26,8 @@ for city in Cities:
|
||||
soup = BeautifulSoup(src, 'html.parser')
|
||||
Apartment = soup.find_all('span', class_='js-placardTitle title')
|
||||
ApartmentAddr = soup.find_all('div', 'property-address js-url')
|
||||
for span in Apartment:
|
||||
print(span)
|
||||
span_soup = BeautifulSoup(span, 'html.parser')
|
||||
Name = span.find('span', class_='js-placardTitle title')
|
||||
print(name.string)
|
||||
for apartment, address in zip(Apartment, ApartmentAddr):
|
||||
#print(apartment)
|
||||
Name = apartment.contents[0]
|
||||
Addr = address.contents[0]
|
||||
print(Name + ", ", Addr)
|
||||
|
||||
Reference in New Issue
Block a user