Created
November 20, 2017 11:51
-
-
Save xnuk/61ca106d2099f26262f179b5cb614cf5 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
const {parse: crawl, SELECTOR, CONVERT, DATA} = require("crawl-it") | |
const {get} = require("request") | |
const {parse: json5} = require('json5') | |
get("http://m.airkorea.or.kr/sub_new/sub11.jsp", (e, r, b) => { | |
console.log(crawl(b, { | |
[DATA]: 'script/text()', | |
[CONVERT]: v => json5('{' + | |
v.split('var wrapper;')[0].trim() | |
.replace(/var\s+JSONObject([^=]+)=/g,'$1:') | |
.replace(/;\r?\n/g,',') | |
.replace(/;$/,'') | |
+ '}') | |
})) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment