app.js
5.4 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var http = require('http');
var server = http.createServer();
var port = 80;
const childProcess = require('child_process');
var list1 = childProcess.execSync('node ./zum/zum.js').toString();
var list2 = childProcess.execSync('node ./nate/nate.js').toString();
server.listen(port, function(){
console.log('Server Start, Port : ' + port);
});
server.on('request', function(req, res){
res.writeHead(200, {'Content-Type': 'text/html'});
res.write("<!DOCTYPE html>");
res.write("<html>");
res.write("<head>");
res.write('<meta charset="UTF-8">');
res.write("<title>실시간 검색어 모아보기</title>");
res.write("<style>")
res.write("div {width: 100%;text-align: center;border: 1px solid #003458;} div.left {width: 50%;float: left;box-sizing: border-box;text-align: center;} div.right {width: 50%;float: right;box-sizing: border-box;text-align: center;}")
res.write("</style>")
res.write("</head>");
res.write("<body>");
res.write("<div>")
res.write("<h1>실시간 검색어 모아보기</h1>");
res.write(new Date() + "<br/>");
res.write("<br/>");
res.write('<div class="left">')
res.write("<h3>" + list1.split(',')[0].substring(5, list1.split(',')[0].length - 1) + "</h3>");
res.write(list1.split(',')[1].substring(4, list1.split(',')[1].length - 1) + "<br/>");
var i = 2;
while(i < list1.split(',').length - 1) {
var str1 = list1.split(',')[i];
res.write("<b>" + str1.substring(4, str1.length - 1) + "</b>" + "<br/>");
res.write('<a href="https://www.google.com/search?q=' + str1.substring(7, str1.length - 1) + '">Google</a> ');
res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + str1.substring(7, str1.length - 1) + '">Naver</a> ');
res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + str1.substring(7, str1.length - 1) + '">Daum</a> ');
res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + str1.substring(7, str1.length - 1) + '">Nate</a> ');
res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + str1.substring(7, str1.length - 1) + '">Zum</a><br/>');
i++;
};
res.write("<b>" + list1.split(',')[i].substring(4, list1.split(',')[i].length - 4) + "</b>" + "<br/>");
res.write('<a href="https://www.google.com/search?q=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Google</a> ');
res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Naver</a> ');
res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Daum</a> ');
res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Nate</a> ');
res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + list1.split(',')[i].substring(7, list1.split(',')[i].length - 4) + '">Zum</a><br/>');
res.write("<br/>");
res.write("</div>")
res.write('<div class="right">')
res.write("<h3>" + list2.split(',')[0].substring(6, list2.split(',')[0].length - 1) + "</h3>");
res.write("<br/>");
var j = 1;
while(j < list2.split(',').length - 1) {
var str2 = list2.split(',')[j];
res.write("<b>" + str2.substring(4, str2.length - 1) + "</b>" + "<br/>");
res.write('<a href="https://www.google.com/search?q=' + str2.substring(7, str2.length - 1) + '">Google</a> ');
res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + str2.substring(7, str2.length - 1) + '">Naver</a> ');
res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + str2.substring(7, str2.length - 1) + '">Daum</a> ');
res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + str2.substring(7, str2.length - 1) + '">Nate</a> ');
res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + str2.substring(7, str2.length - 1) + '">Zum</a><br/>');
j++;
};
res.write("<b>" + list2.split(',')[j].substring(4, list2.split(',')[j].length - 4) + "</b>" + "<br/>");
res.write('<a href="https://www.google.com/search?q=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Google</a> ');
res.write('<a href="https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=0&ie=utf8&query=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Naver</a> ');
res.write('<a href="https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&sq=&o=&q=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Daum</a> ');
res.write('<a href="https://search.daum.net/nate?thr=sbma&w=tot&q=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Nate</a> ');
res.write('<a href="https://search.zum.com/search.zum?method=uni&option=accu&qm=f_typing&rd=1&query=' + list2.split(',')[j].substring(7, list2.split(',')[j].length - 4) + '">Zum</a><br/>');
res.write("<br/>");
res.write("</div>")
res.write("</div>")
res.write("</body>");
res.write("</html>");
res.end();
});