allUrls.forEach(async (item,index)=>{
await page.goto(item.url);
let imgUrls = await page.evaluate(e=>{
let imgs = Array.from($('#picture').find("img"))
return imgUrls = imgs.map((item)=>{
let imgUrl = $(item).attr('src');
let imgAlt = $(item).attr('alt');
return {
imgUrl,imgAlt
}
})
});
allImgUrls = [...allImgUrls,...imgUrls];
});
allImgUrls,allUrls,imgUrls都是数组,循环allUrls根据每一项得到一个数组imgUrls然后整合进allImgUrls里面,但最终结果imgUrls都是allUrls最后一项得到的结果?
求大神解答
12345678_0001
青春有我
相关分类