I've recently started learning scrapy
and I'm struggling to extract the width
from a div
using a CSS Selector
. No matter how hard I try, I can only find solutions using xpath
instead of css
selectors.
Here is the HTML
code snippet:
<div class="stars-container">
<div class="stars" style="width: 60.606%"> Rating</div>
</div>
When I get the response
from the scrapy shell URL
, I've tried the following to select the width
from the above html
:
response.css('.stars-container .stars ::attr(width)')
response.css('.stars-container ::attr(width)')
If someone could help me solve this problem easily, it would be greatly appreciated. Thank You