Reputation: 11
My can't figure out how to get just the title.
response.css('.goods_property_color a.current').extract()
<p id="select-attr-0" class="attr-choose clearfix goods_property_color" data-type="Color"> <span class="property-title">Color</span> <a href="javascript:void(0)" class="itemAttr current -sitemap-select-item-selected" title="WHITE" data-value="WHITE"><img src="https://gloimg.rglcdn.com/rosegal/pdm-product-pic/Clothing/2019/04/08thumb-img/1554676715239391822.jpg" class=""></a>
what I want is just 'WHITE'
but what I get is:
['a href="javascript:void(0)" class="itemAttr current " title="WHITE" data-value="WHITE"> src=h://gloimg.rglcdn.com/rosegal/pdm-product-pic/Clothing/2019/04/08thumb-img/1554676715239391822.j"></a>']
Upvotes: 0
Views: 41
Reputation: 3740
response.css('.goods_property_color a.current::attr(data-value)').get()
or
response.css('.goods_property_color a.current::attr(title)').get()
Upvotes: 1