Мне нужно получить данные из html, но response.css, response.xpath и их комбинация не работают всякий раз, когда я пытаюсь получить данные «обычной цены», они всегда говорят «нет»
Мне нужночтобы получить текст значения enter code here
, что составляет $ 17,99
вот мой код
HTML
<div class="price parbase"><div class="primary-row product-item-price product-item-price-discount">
<span class="price-value">$12.99</span><small class="js-price-value-original price-value-original">$17.99</small>
</div>
</div>
Scrapy Python
def parse_subpage(self, response):
item = {
'title': response.css('h1.primary.product-item-headline::text').extract_first(),
'sale-price': response.xpath("normalize-space(.//span[@class='price-value']/text())").extract_first(),
'regular-price': response.css('.js-price-value-original').xpath("@small").extract_first(),
'photo-url': response.css('div.product-detail-main-image-container img::attr(src)').extract_first(),
'description': response.css('p.pdp-description-text::text').extract_first()
}
yield item
вывод должен быть по обычной цене: $ 17,99
пожалуйста, помогите, спасибо!