main.js
1.18 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
const mysql = require("mysql");
const khuuniv = require('./site_modules/KHU')
const swuniv = require('./site_modules/swuniv')
const janghak1 = require("./site_modules/janghak1")
const janghak2 = require("./site_modules/janghak2")
async function loading(){
li = await swuniv.loading();
for(var i = 0; i < li.length;i++){
await insertNotice(li[i]);
}
li = await khuuniv.loading();
for(var i = 0; i < li.length;i++){
await insertNotice(li[i]);
}
li = await janghak1.loading();
for(var i = 0; i < li.length;i++){
await insertNotice(li[i]);
}
li = await janghak2.loading();
for(var i = 0; i < li.length;i++){
await insertNotice(li[i]);
}
}
var connection = mysql.createConnection({
host: "34.64.183.182",
user: 'root',
password: '',
database: 'KhuNotice'
})
connection.connect();
async function insertNotice(singleNotice){
date = singleNotice.date;
title = singleNotice.title;
link = singleNotice.link;
site = singleNotice.site;
await connection.query(`insert into noticeList (date, title, link, site) values('${date}','${title}','${link}','${site}')`,function(err){});
}
loading();