Created
May 5, 2017 14:00
-
-
Save Daymannovaes/419d2a6ee67e63c3a60b6cb0a301d37f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://mg.olx.com.br/belo-horizonte-e-regiao/eletrodomesticos?f=p&pe=1200&ps=800&q=geladeira | |
results = $('#main-ad-list li:not(.list_native)').map((a, i) => { | |
let $f = $(i).find.bind($(i)); | |
return { | |
href: $f('a')[0].href, | |
title: $f('h3').text().trim(), | |
price: $f('.OLXad-list-price').text().trim().replace(/R\$ ?/, '').replace(/\./, ','), | |
region: $f('.detail-region').text().trim().replace(/\n/g, '').replace(/\t/g, '').replace(/ +/g, ' '), | |
time: $f('.col-4').text().trim().replace(/\n/g, '').replace(/\t/g, '').replace(/ +/g, ' '), | |
} | |
}); | |
results.toArray().map(({ href, title, price, region, time }) => `${title} ${price} ${region} ${time} ${href}`).join('\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment