These are chat archives for rosshinkley/nightmare

4th
Jun 2017
Timo Hausmann
@timohausmann
Jun 04 2017 11:45
Hey, can someone help me fetch a list of links? I am new to nightmare/phantom and I have no idea why this does not compute? https://jsfiddle.net/rqs7b175/
I just get an array with empty objects. The length is equal to the amount of links on the page, but there is just no data :(
Timo Hausmann
@timohausmann
Jun 04 2017 12:02
Ah, got it, NodeList does not serialize well. An example with querySelectorAll in your docs would be super helpful! (this helped https://stackoverflow.com/questions/42471836/nightmarejs-scrape-multiple-elements-with-queryselectorall)
Timo Hausmann
@timohausmann
Jun 04 2017 12:40
nobody there to help? This is all very confusing :(
Flamur Kasa
@FKasa
Jun 04 2017 12:42
try not spreading your array
try with JSON.stringify, maybe it will give you more info
Timo Hausmann
@timohausmann
Jun 04 2017 12:47
I managed to fetch multiple pages by creating a new Nightmare() for each request, I feel like this is very bad practice? https://jsfiddle.net/79sk19uL/
Flamur Kasa
@FKasa
Jun 04 2017 12:53
dunno
1 of them might actually answer my question
Timo Hausmann
@timohausmann
Jun 04 2017 12:55
Thanks, yeah my problem is described there, but I'm unable to refactor it to my needs. I'm probaby lacking too much knowledge about node.js :T it's alright, I will try to find some ugly way to do it
Flamur Kasa
@FKasa
Jun 04 2017 13:04
Try this:
var imgs = [...document.querySelectorAll('._icyx7')];
var alts = [];
for ( var i in imgs ){
    alts.push( imgs[i].alt )
}
return alts;
Timo Hausmann
@timohausmann
Jun 04 2017 13:26
Thanks for your efforts! Bye