I want to scrape the sold price of property from
what should I do in this case? Each table represents each property. I need the sold price for each property and hence each table.
response.css('tbody').getall()
returns nothing at all.
CodePudding user response:
using xpath you could use:
for element in response.xpath("//table//table//table"):
sold = element.xpath(".//b")[0].xpath("./text()").get()
print(sold)
date = element.xpath(".//td")[0].xpath("./text()").get()
output:
Sold $640,000
Sold $640,000
Sold $320,000
Sold $320,000
Sold $145,000
Sold $145,000
Sold $145,000
Sold $145,000
Sold $239,000
Sold $239,000
Sold $695,000
Sold $695,000
Sold $740,000
Sold $740,000
Sold $375,000
Sold $375,000
Sold $390,000
Sold $390,000
Sold $695,000
Sold $695,000