이태화

git ignore fixed

*.log
node_modules
\ No newline at end of file
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){});
}
module.exports.loading = loading;
\ No newline at end of file
const axios = require("axios");
const cheerio = require("cheerio");
var getHTML = async function(link){
try{
return await axios.get(link);
} catch(e){
console.log(e);
}
}
async function getList(link){
list = [];
HTML = await getHTML(link);
var $ = cheerio.load(HTML.data);
var titleList = $('tr');
titleList.each(function(i, elem){
list[i] = {
title: $(this).find(".txt06").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
link: "https://www.khu.ac.kr/kor/notice/"+$(this).find("a").attr('href'),
date: $(this).find(".col04").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
site: '경희대학교 공지사항'
}
})
list = list.filter(item => item.title);
return list
}
async function loading(){
li = await getList('https://www.khu.ac.kr/kor/notice/list.do?category=GENERAL&page=1');
return li;
}
module.exports.loading = loading;
\ No newline at end of file
const axios = require("axios");
const cheerio = require("cheerio");
const Iconv = require("iconv").Iconv;
var iconv = new Iconv('euc-kr', 'UTF-8//translit//ignore');
var getHTML = async function(link){
try{
return await axios.request({
method: 'GET',
url: link,
responseType: "arraybuffer",
responseEncoding: "binary"
})
} catch(e){
console.log(e);
}
}
async function getList(link){
list = [];
HTML = await getHTML(link);
body = iconv.convert(HTML.data);
var $ = cheerio.load(body);
var titleList = $('.bg1');
titleList.each(function(i, elem){
list[i] = {
title: $(this).find(".subject").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
link: "http://janghak.khu.ac.kr/board" + $(this).find("a").attr('href').substr(2),
date: $(this).find(".datetime").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
site: '경희대학교 장학센터'
}
})
list = list.filter(item => item.title);
return list
}
async function loading(){
li = await getList('http://janghak.khu.ac.kr/board/bbs/board.php?bo_table=06_01');
return li;
}
module.exports.loading = loading;
\ No newline at end of file
const axios = require("axios");
const cheerio = require("cheerio");
const Iconv = require("iconv").Iconv;
var iconv = new Iconv('euc-kr', 'UTF-8//translit//ignore');
var getHTML = async function(link){
try{
return await axios.request({
method: 'GET',
url: link,
responseType: "arraybuffer",
responseEncoding: "binary"
})
} catch(e){
console.log(e);
}
}
async function getList(link){
list = [];
HTML = await getHTML(link);
body = iconv.convert(HTML.data);
var $ = cheerio.load(body);
var titleList = $('.bg2');
titleList.each(function(i, elem){
list[i] = {
title: $(this).find(".subject").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
link: "http://janghak.khu.ac.kr/board" + $(this).find("a").attr('href').substr(2),
date: $(this).find(".datetime").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
site: '경희대학교 장학센터'
}
})
list = list.filter(item => item.title);
return list
}
async function loading(){
li = await getList('http://janghak.khu.ac.kr/board/bbs/board.php?bo_table=06_01');
return li;
}
module.exports.loading = loading;
\ No newline at end of file
const axios = require("axios");
const cheerio = require("cheerio");
var getHTML = async function(link){
try{
return await axios.get(link);
} catch(e){
console.log(e);
}
}
async function getList(link){
list = [];
HTML = await getHTML(link);
var $ = cheerio.load(HTML.data);
var titleList = $('tr');
titleList.each(function(i, elem){
list[i] = {
title: $(this).find(".bo_tit").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
link: $(this).find("a").attr('href').replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
date: $(this).find(".td_datetime").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, ""),
site: '소프트웨어 융합대학 공지사항'
}
})
list = list.filter(item => item.title);
return list
}
async function loading(){
li = await getList('http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1');
return li;
}
module.exports.loading = loading;
......@@ -17,6 +17,11 @@
"defer-to-connect": "^1.0.1"
}
},
"@types/node": {
"version": "14.14.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.7.tgz",
"integrity": "sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg=="
},
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
......@@ -78,6 +83,14 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"axios": {
"version": "0.21.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz",
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
......@@ -110,6 +123,11 @@
"type-is": "~1.6.17"
}
},
"boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"boxen": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz",
......@@ -205,6 +223,19 @@
}
}
},
"cheerio": {
"version": "1.0.0-rc.3",
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz",
"integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==",
"requires": {
"css-select": "~1.2.0",
"dom-serializer": "~0.1.1",
"entities": "~1.1.1",
"htmlparser2": "^3.9.1",
"lodash": "^4.15.0",
"parse5": "^3.0.1"
}
},
"chokidar": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz",
......@@ -307,6 +338,22 @@
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
"integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="
},
"css-select": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
"integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=",
"requires": {
"boolbase": "~1.0.0",
"css-what": "2.1",
"domutils": "1.5.1",
"nth-check": "~1.0.1"
}
},
"css-what": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz",
"integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg=="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
......@@ -343,6 +390,37 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"dom-serializer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
"integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==",
"requires": {
"domelementtype": "^1.3.0",
"entities": "^1.1.1"
}
},
"domelementtype": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
"integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w=="
},
"domhandler": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz",
"integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==",
"requires": {
"domelementtype": "1"
}
},
"domutils": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
"integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=",
"requires": {
"dom-serializer": "0",
"domelementtype": "1"
}
},
"dot-prop": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
......@@ -379,6 +457,11 @@
"once": "^1.4.0"
}
},
"entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
},
"escape-goat": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz",
......@@ -453,6 +536,11 @@
"unpipe": "~1.0.0"
}
},
"follow-redirects": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
......@@ -526,6 +614,31 @@
"resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz",
"integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw=="
},
"htmlparser2": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
"integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==",
"requires": {
"domelementtype": "^1.3.1",
"domhandler": "^2.3.0",
"domutils": "^1.5.1",
"entities": "^1.1.1",
"inherits": "^2.0.1",
"readable-stream": "^3.1.1"
},
"dependencies": {
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
......@@ -543,6 +656,11 @@
"toidentifier": "1.0.0"
}
},
"iconv": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/iconv/-/iconv-3.0.0.tgz",
"integrity": "sha512-bKTEP55J/e+UutBE3BDBWq6KukPWh3GBYCZGbLEY9vxRDUU2F3bqvPsp/a/DEdIamgF2MvW5lF0Rj1U/7KRL+g=="
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
......@@ -680,6 +798,11 @@
"package-json": "^6.3.0"
}
},
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
"lowercase-keys": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
......@@ -822,6 +945,14 @@
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz",
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ=="
},
"nth-check": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
"integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
"requires": {
"boolbase": "~1.0.0"
}
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
......@@ -861,6 +992,14 @@
}
}
},
"parse5": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz",
"integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==",
"requires": {
"@types/node": "*"
}
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
......
......@@ -7,8 +7,11 @@
},
"license": "MIT",
"dependencies": {
"axios": "^0.21.0",
"cheerio": "^1.0.0-rc.3",
"crypto": "^1.0.1",
"express": "^4.17.1",
"iconv": "^3.0.0",
"mysql": "^2.18.1",
"nodemon": "^2.0.6"
},
......
const fs = require ('fs');
const DBUpdate = require('../DBUpdate/main');
var root = function (req, res) {
DBUpdate.loading();
fs.readFile('./public/index.html',function(data){
res.send(data)
});
}
module.exports = root;
\ No newline at end of file
......