KHU.js 1013 Bytes
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;