From 12f4d584f8cbb10b2234b37810728fb924086a52 Mon Sep 17 00:00:00 2001 From: AndreiCherniaev Date: Tue, 20 Aug 2024 12:08:22 +0900 Subject: [PATCH] Not getting price from amazon product detail page details https://github.com/python-scrapy-playbook/amazon-python-scrapy-scraper/issues/4 --- amazon/spiders/amazon_search_product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amazon/spiders/amazon_search_product.py b/amazon/spiders/amazon_search_product.py index 0a5f2df..80cdd16 100644 --- a/amazon/spiders/amazon_search_product.py +++ b/amazon/spiders/amazon_search_product.py @@ -43,7 +43,7 @@ def parse_product_data(self, response): image_data = json.loads(re.findall(r"colorImages':.*'initial':\s*(\[.+?\])},\n", response.text)[0]) variant_data = re.findall(r'dimensionValuesDisplayData"\s*:\s* ({.+?}),\n', response.text) feature_bullets = [bullet.strip() for bullet in response.css("#feature-bullets li ::text").getall()] - price = response.css('.a-price span[aria-hidden="true"] ::text').get("") + price = response.css('.a-price-decimal span[aria-hidden="true"] ::text').get("") if not price: price = response.css('.a-price .a-offscreen ::text').get("") yield { @@ -54,4 +54,4 @@ def parse_product_data(self, response): "feature_bullets": feature_bullets, "images": image_data, "variant_data": variant_data, - } \ No newline at end of file + }