Open eklem opened 10 years ago
Mostly I guess this is a result of lacking JavaScript/jQuery-knowledge from my side, but I'll put my findings in the Wiki, so please help me out.
I got a page with a UL-list, and the result from the adapter is just the content of the last LI-tag: "melis" Actual page: http://www.flickr.com/photos/eklem/11321534604/ Firepath-debugging: http://www.flickr.com/photos/eklem/11321534604/
The adapter-jQuery:
$(".ingredients .ingredientWrapper").each(function(i, e) { var ingredients = $(e); doc['ingredients'] = ingredients.text(); });
So I understand that it's overwritten each time "each" runs, but how to get a nice ingredients-json-list with several singular "ingredient"?
Seems I found the answer in Cheerio's documentation: https://github.com/cheeriojs/cheerio#each-functionindex-element-
I'll test later and update the wiki if it works.
Mostly I guess this is a result of lacking JavaScript/jQuery-knowledge from my side, but I'll put my findings in the Wiki, so please help me out.
I got a page with a UL-list, and the result from the adapter is just the content of the last LI-tag: "melis" Actual page: http://www.flickr.com/photos/eklem/11321534604/ Firepath-debugging: http://www.flickr.com/photos/eklem/11321534604/
The adapter-jQuery:
So I understand that it's overwritten each time "each" runs, but how to get a nice ingredients-json-list with several singular "ingredient"?