kt.js
1.53 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var express = require('express');
var router = express.Router();
const getXports = require('../crawling/xports.js');
const getZum = require('../crawling/zum.js');
const getChosun = require('../crawling/chosun.js');
const getYna = require('../crawling/yna.js');
const getIsplus1 = require('../crawling/isplus1.js');
const getIsplus2 = require('../crawling/isplus2.js');
const getIsplus3 = require('../crawling/isplus3.js');
const getIsplus4 = require('../crawling/isplus4.js');
let isplus1;
let isplus2;
let isplus3;
let isplus4;
let xports;
let zum;
let chosun;
let yna;
let newslist;
let kt = new Array();
const loadlist = async function() {
try {
newlist = []
isplus1 = await getIsplus1();
isplus2 = await getIsplus2();
isplus3 = await getIsplus3();
isplus4 = await getIsplus4();
xports = await getXports();
zum = await getZum();
chosun = await getChosun();
yna = await getYna();
newslist = isplus1.concat(isplus2, isplus3, isplus4, xports, zum, chosun, yna);
let searchlist = ['kt', 'KT', 'wiz', 'WIZ', '케이티', '위즈', '강백호', '이강철', '수원'];
kt = []
for(var i of newslist){
for (var j of searchlist){
if(i.title.indexOf(j) !== -1 || i.summary.indexOf(j) !== -1){
kt.push(i);
break;
}
}
}
console.log("kt loaded");
} catch (e) {
return console.log(e);
}
};
loadlist();
router.get('/', function(req, res, next){
loadlist();
res.render('kt', {
kt : kt
});
});
module.exports = router;