Values in separate rows - what kind of element selector?

First off, I want to say what a great tool this is. I've used it for a couple of small sites and relatively simple scrapes but my first bigger project lead to a dead end. I'm trying to scrape a list of urls to get some recipes. Getting the name, the description and the preparation is easy. My problem is, I wanna get all the ingredients, the quantity and the unit (in ml, not oz) in a single row. At the moment I'm ending up with values in separate rows (as described in here). I stumbled upon this topic and I read the documentation. I guess I have to use some kind of element selector but I can't seem to wrap my head around what I'm doing wrong.

Any help would be greatly appreciated. Thanks in advance!

URL: https://www.liquor.com/recipes/old-fashioned/

Sitemap:
{"_id":"liquor","startUrl":["https://www.liquor.com/recipes/old-fashioned/"],"selectors":[{"id":"name","type":"SelectorText","parentSelectors":["_root"],"selector":"h1[itemprop='name']","multiple":false,"regex":"","delay":0},{"id":"status","type":"SelectorText","parentSelectors":["_root"],"selector":"#verified i:nth-of-type(1)","multiple":false,"regex":"","delay":0},{"id":"image","type":"SelectorImage","parentSelectors":["_root"],"selector":"img.wp-post-image.img-responsive","multiple":false,"delay":0},{"id":"recipe","type":"SelectorElement","parentSelectors":["_root"],"selector":"div.recipe-main-content","multiple":false,"delay":0},{"id":"about","type":"SelectorText","parentSelectors":["recipe"],"selector":"[itemprop='description'] p","multiple":false,"regex":"","delay":0},{"id":"preparation","type":"SelectorText","parentSelectors":["recipe"],"selector":"[itemprop='recipeInstructions']","multiple":false,"regex":"","delay":0},{"id":"ingredients","type":"SelectorElement","parentSelectors":["recipe"],"selector":"div.x-recipe-ingredients","multiple":false,"delay":0},{"id":"quanity","type":"SelectorElementAttribute","parentSelectors":["ingredients"],"selector":"div.measure","multiple":true,"extractAttribute":"data-ml","delay":0},{"id":"ingredientname","type":"SelectorText","parentSelectors":["ingredients"],"selector":"div.x-recipe-ingredient","multiple":true,"regex":"","delay":0}]}

If you want all the ingredients in one line, you can try the Grouped selector:

Type: Grouped
Selector: div.x-recipe-unit:nth-of-type(n+2),.col-xs-9 div:nth-of-type(n+1) .col-xs-9 span.oz-value

This should get you both the ingredients and garnish in one line. The result is in Json format which you'll need to post-process, but the text patterns are predictable.

1 Like