Skip to content

Instantly share code, notes, and snippets.

@galdolber galdolber/paginas.js
Created Sep 24, 2018

Embed
What would you like to do?
Paginas
biz = document.getElementsByClassName("business");
ret = [];
for(n=0;n<biz.length; n++) {
b = biz[n];
cbox = false;
try {b.children[2].children[0].children[1].children[0].className == "chatBox";}catch(e){};
try {
p1=b.querySelector("*[itemprop='telephone']");
ret.push({"email": b.children[0].value,
"nombre": b.querySelector("*[itemprop='name']").textContent.trim(),
"tipo": b.querySelector("*[class='business-categories']").children[0].textContent.trim(),
"direccion": b.querySelector("*[itemprop='streetAddress']").textContent.trim().replace(/\s{2,}/g, ' '),
"provincia": b.querySelector("*[itemprop='addressLocality']").textContent.trim().replace(/\s{2,}/g, ' '),
"web": b.querySelector("*[itemprop='url']").content,
"info": b.querySelector("*[itemprop='description']").textContent.trim(),
"telefono": p1.tagName == 'DIV'? p1.children[0].href : p1.href
});
} catch (e) {
console.log("skipping one");
}
};
console.log(JSON.stringify(ret));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.