You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
613 B

import scrapy
class ScrapePerils(scrapy.Spider):
name = "perils"
start_urls = ["https://www.marseille.fr/logement-urbanisme/am%C3%A9lioration-de-lhabitat/arretes-de-peril"]
def parse(self, response):
for adresses in response.xpath('//div[@class="card"]//li'):
yield {
'adresse': adresses.xpath('./text()').get(),
'dernier arrêté hors modificatif' : adresses.xpath('./a[not(contains(translate(.,"MODIF","modif"),"modif"))][last()]/text()').get(),
'dernier arrêté' : adresses.xpath('./a[last()]/text()').get(),
}