-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-scraper.js
31 lines (27 loc) · 921 Bytes
/
web-scraper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const puppeteer = require('puppeteer');
let scrape = async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('http://urban-sustain.org/aperture3/aperture-client/',{waitUntil: 'load', timeout: 0});
await page.waitFor(1000);
const result = await page.evaluate(() => {
let subels = []
let allels = document.getElementsByTagName("*");//
// let v = document.querySelectorAll("#mMap2")
if(allels.length > 0) {
for (i = 0; i < allels.length; i++) {
subels.push(
{
'id' : allels[i].id, //titles[i].textContent,
'element': allels[i]
})
}
}
return subels
});
browser.close();
return result;
}
scrape().then((value) => {
console.log(value);
});