You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want the price. I'd like to have the sale price and if none is provided the original price. I've tried 3 diff ways to achieve this. The first, which I believe would probably be the best syntax for this to be implemented, comma delimited selectors.
Then I tried { "price?": "#productpreview .salenum", "price": "#productpreview .pricenum" }
finally because my crawling software (Scrapy) takes the first object from the list { "price": ["#productpreview .salenum, #productpreview .pricenum"] }
... but order is not preserved so that isn't reliable. If order was preserved this would be my second choice.
Any thoughts? or has this already been implemented?
Andrew
The text was updated successfully, but these errors were encountered:
Right, so the logical OR operators (css comma or pipe in xpath), maintain order, but with respect to the page. So the original price will always come first, because it's higher on the page.
This is getting to be a little to much logic for Parsley, which was never designed to be Turing-complete. I can see implementing a reverse() function, which would give you a workaround here. My approach to this problem is reflected in the csvget project, where each row is optionally post-processed in Ruby.
One of the features that I wanted to suggest is some sort of logical OR operator.
For example,
http://www.bestbuy.com/site/Swiss+Gear+-+SHERPA+Laptop+Sleeve+-+Black/Blue/8819264.p?skuId=8819264&id=1206750211247
I want the price. I'd like to have the sale price and if none is provided the original price. I've tried 3 diff ways to achieve this. The first, which I believe would probably be the best syntax for this to be implemented, comma delimited selectors.
{ "price": "#productpreview .salenum, #productpreview .pricenum" }
Then I tried
{ "price?": "#productpreview .salenum", "price": "#productpreview .pricenum" }
finally because my crawling software (Scrapy) takes the first object from the list
{ "price": ["#productpreview .salenum, #productpreview .pricenum"] }
... but order is not preserved so that isn't reliable. If order was preserved this would be my second choice.
Any thoughts? or has this already been implemented?
Andrew
The text was updated successfully, but these errors were encountered: