I need to parse this page “https://xn--80az8a.xn--d1aqf.xn--p1ai/%D1%81%D0%B5%D1%80%D0%B2%D0%B8%D1%81%D1%8B/%D0%BA%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3-%D0%BD%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D1%80%D0%BE%D0%B5%D0%BA/%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA-%D0%BE%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D0%BE%D0%B2/%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA?place=0-1&objStatus=0” I wrote the code, but it returns None, I don’t know why, as if it just doesn’t find the CSS selector, please help, I’ve been stuck with this problem for 3 days.
import scrapy
class BuildingSpiderSpider(scrapy.Spider):
name = "building_spider"
allowed_domains = ["xn--80az8a.xn--d1aqf.xn--p1ai"]
start_urls = [
"https://xn--80az8a.xn--d1aqf.xn--p1ai/%D1%81%D0%B5%D1%80%D0%B2%D0%B8%D1%81%D1%8B/%D0%BA%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3-%D0%BD%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D1%80%D0%BE%D0%B5%D0%BA/%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA-%D0%BE%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D0%BE%D0%B2/%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA?place=0-1&objStatus=0",
]
def parse(self, response):
buildings = response.css('div.NewBuildingItem__Wrapper-sc-o36w9y-0.iYDe')
for building in buildings:
link = building.css('a.NewBuildingItem__ImageWrapper-sc-o36w9y-2.iLOAue::attr(href)').get()
title = building.css('a.NewBuildingItem__MainTitle-sc-o36w9y-6.KYYzh::text').get()
address = building.css('p.NewBuildingItem__Text-sc-o36w9w-7.iUiqkY::text').get()
building_id = building.css('p.NewBuildingItem__Text-sc-o36w9y-7.NewBuildingItem__ObjectID-sc-o36w9y-8.iUiqkY.cgrVoh::text').get()
commissioning = building.css('p.NewBuildingItem__InfoValue-sc-o36w9y-11.jZCQkA::text').get()
developer = building.css('p.NewBuildingItem__InfoValue-sc-o36w9y-11.jZCQkA::text').get()
yield {
'link': link,
'title': title,
'address': address,
'id': building_id,
'commissioning': commissioning,
'developer': developer
}
I tried changing the css selector in the code, no matter how much I changed the code, nothing helped.
Клим is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.