From bc3caf3b51b0908636360f92bad5970be5533a0e Mon Sep 17 00:00:00 2001 From: ayxan Date: Tue, 6 Sep 2022 04:25:11 +0400 Subject: [PATCH] images added --- src/post_scrape/spiders/car_spider.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/post_scrape/spiders/car_spider.py b/src/post_scrape/spiders/car_spider.py index b32ce6a..49589d0 100644 --- a/src/post_scrape/spiders/car_spider.py +++ b/src/post_scrape/spiders/car_spider.py @@ -27,6 +27,8 @@ class ToScrapeCSSSpider(scrapy.Spider): yield response.follow(f"https://turbo.az{next_page}", callback=self.parse, headers=self.headers) def parse_detail_url(self, r): + images = [r.xpath('//a[@class="product-photos-large"]/@href').get()] + images += r.xpath('//div[@class="product-photos"]/div/a/@href').getall() if r.xpath('//div[@class="shop-container"]'): avto_salon = True phone = r.xpath('//div[@class="shop-contact--phones-list"]//a[@class="shop-contact--phones-number"]/text()').getall() @@ -90,6 +92,7 @@ class ToScrapeCSSSpider(scrapy.Spider): yield { 'url': r.url, 'avto_salon': avto_salon, + 'images': images, 'phone': phone, 'extra_fields': extra_fields, 'description': description,