-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (31 loc) · 1.07 KB
/
Copy pathindex.js
File metadata and controls
49 lines (31 loc) · 1.07 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
(async () => {
async function getBody(url, delayTime) {
function delay(time) {
return new Promise(function(resolve) {
setTimeout(resolve, time)
});
}
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox"]
});
const page = await browser.newPage();
await page.setViewport({
width: 1366,
height: 768
});
const DOM = await page.goto(url);
await delay(delayTime);
return await page.evaluate(() => document.body.outerHTML);
}
const body = await getBody('https://place.map.kakao.com/1948529078', 1000);
const $ = cheerio.load(body);
const bg_present = cheerio.html($('.bg_present'));
console.log();
const innerStyle = $('.bg_present').attr('style');
const pattern = /\(\'+/;
const ret = pattern.exec(innerStyle)['input'];
console.log(ret.substring(22, ret.length - 2));
})();