Open ejulio opened 5 years ago
Hi @ejulio @Gallaecio! I'd like to know your thoughts on scrapy/scrapy#3795 for discussion as it's closely related to this. :)
Then, if selector1 yields a result, the other ones are attempted,...
Then, if selector1 yields a result, the other ones are NOT attempted,...
In some cases it is common to have fallback selectors for certain fields. This way, we end up writing a piece of code like
However, a, maybe, better way would be
The API above would be the equivalent of the first example. However, @cathalgarvey also shared a nice idea to stop in the first matching selector.
Then, if
selector1
yields a result, the other ones are not attempted, otherwise we fallback toselector2
and so on.The same API should be applied to
loader.add_xpath
.