Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

Using Scrapy, when I try to scrape two almost identical pages, the CSS selector works for one but not the other

$
0
0

The selector is:

response.css('div.dp-conteudo__esquerda span.varpb').extract_first()

Pages are this and that.

First one returns the correct span normally, but the second one doesn't return anything.

The only relevant difference I can see is that the second page has a span with the varpb class appear first in a different part of the code, but it's the same as the other one I wanted. In line 581 of second page's source code:

...<a class="--link" href="/putear"><span class="varpt">putear</span><span class="varpb">putear</span></a><span class="mx-2" style="color:#888888;">]</span></item> ou...

Even if it didn't get the "correct" span, shouldn't it get this one? Am I missing something?

To make this clear: I don't care about making it work (by other means;changing the selector), I want to understand why it doesn't, please.

If any portuguese-speaking person wonders why I was scraping these words, it was for a game of Scrabble.


Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>