Pass parameter to scrape evaluate function
Closed this issue · 1 comments
art1c0 commented
I need to make query selector parameterized for evaluate function.
For example, in this code:
.scrape(function($) {
return $(".title a").map(function() {
return $(this).text();
}).get();
})
I need this ".title a" to be dynamic, coming as parameter.
How to achieve that? This is very crusial... Thanks!
art1c0 commented
For those who might wonderm the soution is:
.scrape(
function($, query) {
return $(query).map(function() {
return $(this).text();
}).get();
},
function(data, utils) {
console.log('data', data);
},
queryString
);