Issue
I am trying to scrape a website and I want to scrape a custom html attribute.
First I get the link:
result.css('p.paraclass a').extract()
It looks like this:
<a href="https://thisisawebsite.com" data-id="12345" class="aclass">I am a link</a>
I'd like to scrape the value of the data-id tag. I can do this by getting the entire link and then manipulating it, but I'd like to figure out if there is a way to do it directly with a scrapy selector.
Solution
I believe the following will work:
result.css('a::attr(data-id)').extract()
Answered By - Ethan Koch
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.