Skip to content

Instantly share code, notes, and snippets.

@galdolber
Created September 24, 2018 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galdolber/4a8a5625726e4adbc4db97bc23522061 to your computer and use it in GitHub Desktop.
Save galdolber/4a8a5625726e4adbc4db97bc23522061 to your computer and use it in GitHub Desktop.
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