mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update census.js
This commit is contained in:
parent
ae0cba0117
commit
8876f30837
|
@ -1,16 +1,18 @@
|
|||
// Example: Crawling a title of websites
|
||||
|
||||
var FILE = require("lib/file");
|
||||
var HTTP = require("lib/http");
|
||||
var Punycode = require("lib/punycode");
|
||||
|
||||
function main()
|
||||
var lines = [];
|
||||
function main() {
|
||||
var lines = [];
|
||||
|
||||
var district = JSON.parse(FILE.readFile("data\\korea-administrative-district.json", "utf-8"));
|
||||
var districtData = district.data;
|
||||
var district = JSON.parse(FILE.readFile("data\\korea-administrative-district.json", "utf-8"));
|
||||
var districtData = district.data;
|
||||
|
||||
var domains = splitLn(FILE.readFile("data\\domains.txt", "utf-8"));
|
||||
var domains = splitLn(FILE.readFile("data\\domains.txt", "utf-8"));
|
||||
|
||||
var digFrame = function(handler, domain, response) {
|
||||
var digFrame = function(handler, domain, response) {
|
||||
var frameURLs = handler.getFrameURLs();
|
||||
|
||||
if (frameURLs.length > 0) {
|
||||
|
@ -26,9 +28,9 @@ var digFrame = function(handler, domain, response) {
|
|||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
};
|
||||
|
||||
domains.forEach(function(domain) {
|
||||
domains.forEach(function(domain) {
|
||||
var handler = HTTP.create("CURL")
|
||||
.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36")
|
||||
.setIsFollowRedirect(true)
|
||||
|
@ -72,9 +74,9 @@ domains.forEach(function(domain) {
|
|||
var bizNote = '';
|
||||
var row = [domain, title, bizNo, bizRegion, bizType, bizForm, bizNote];
|
||||
lines.push(row.join(":"));
|
||||
});
|
||||
});
|
||||
|
||||
FILE.appendFile("data\\matches.txt", lines.join("\r\n"), "utf-8");
|
||||
FILE.appendFile("data\\matches.txt", lines.join("\r\n"), "utf-8");
|
||||
}
|
||||
|
||||
exports.main = main;
|
||||
|
|
Loading…
Reference in New Issue
Block a user