I can't use map function in the right way within google apps script while scraping two fields—movie name
and image
— from a
But since you aren't returning anything, just use each
as mentioned by Sysix.
Note:
- For some reason, execution doesn't end if I return both values into
result
when usingmap
and trying to logresult
. - I tested another way to store the data and the script below worked.
var result = [];
container.each((index, item) => {
const movieName = $(item).find('a.browse-movie-title').text();
const movieImage = $(item).find('img.img-responsive').attr('src');
result.push([movieName, movieImage]);
});
console.log(result);