Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Kooben209 committed May 9, 2019
1 parent 942506d commit b4b77e2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scraper.py
Expand Up @@ -128,11 +128,21 @@ def saveToStore(data):
propId=re.findall('\d+',propLink)
title = advert.find("h2", {"class" : "propertyCard-title"}).text
address = advert.find("address", {"class" : "propertyCard-address"}).find("span").text
branchName = advert.find("span", {"class" : "propertyCard-branchSummary-branchName"}).text

branchNameLocation = branchName.split(',')[-1].strip().lower()

for r in (("auctions", ""), ("branch", ""), ("- sales", ""), ("sales", ""), ("Nationwide",""), ("Country Department","")):
branchNameLocation = branchNameLocation.replace(*r).strip()

if(branchNameLocation == ""):
branchNameLocation = address.split(',')[-1].strip()

link = advert.find("a", {"class" : "propertyCard-link"})

if location.lower() == 'uk':
location = addressLastPart.title()
hashTagLocation = addressLastPart.replace("_"," ").title().replace(" ","")
location = branchNameLocation.title()
hashTagLocation = branchNameLocation.replace("_"," ").title().replace(" ","")

price = parseAskingPrice(advert.find("div", {"class" : "propertyCard-priceValue"}).text)
displayPrice = advert.find("div", {"class" : "propertyCard-priceValue"}).text
Expand Down

0 comments on commit b4b77e2

Please sign in to comment.