Lazy load crawl
Closed this issue · 2 comments
minasvisual commented
please, i need loop e list with others items like:
title 1
item 1 - value
item 2 - value
title 2
item 1 - value
item 2 - value
item 3 - value
that returns:
{
title: 'title 1'
specs: [
key: item 1, value: value
key: item 2, value: value
]...
Knovour commented
I add a jquery DOM target as a variable in process function
c3367c1
You can use process (val, $elem) {}
in your config now
minasvisual commented
Works!
specs:{
elem:'.line-box__info',
collect: {
loop: true,
get: 'text',
process: (item, row) => {
console.log(row.html())
return { tag: row.find('strong').text(), value: row.find('p').text() };
}
}
}
result
"specs": [
{
"tag": "Tração",
"value": "Dianteira"
},
{
"tag": "Câmbio",
"value": "Manual"
},
{
"tag": "Embreagem",
"value": "Monodisco a seco"
}
]
about loops, the documentation require a little more details.
thanks a lot!