이태화

database server needed

const swuniv = require('./swuniv.js');
const swuniv = require('./silte_modules/swuniv.js')
async function loading(){
li = await swuniv.loading();
console.log(li);
}
loading();
console.log(swuniv);
......
......@@ -9,10 +9,11 @@ var getHTML = async function(link){
}
}
getHTML("http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1").then(function(HTML){
async function getList(link){
list = [];
HTML = await getHTML(link);
var $ = cheerio.load(HTML.data);
var titleList = $('tr');
var list = [];
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, ""),
......@@ -21,24 +22,13 @@ getHTML("http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1").
site: '소프트웨어 융합대학 공지사항'
}
})
});
getHTML("http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=2").then(function(HTML){
var $ = cheerio.load(HTML.data);
var titleList = $('tr');
var list = [];
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: '소프트웨어 융합대학 공지사항'
}
})
});
for(var i =0;i<list.length;i++){
console.log(i);
console.log(list[i]);
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');
console.log(li);
}
module.exports.loading = loading;
......
function fetchItem(){
return new Promise(function(resolve,reject){
setTimeout(function(){
resolve();
console.log("resolved");
},3000)
})
}
async function hello(){
await fetchItem();
await fetchItem();
await fetchItem();
await fetchItem();
await fetchItem();
await fetchItem();
console.log("resolve Complete")
}
hello();
\ No newline at end of file
console.log('2019-01-31' < '2019-01-01');
\ No newline at end of file
......