강상위

Union with Front

...@@ -27,7 +27,7 @@ var Users = require('./models/users'); ...@@ -27,7 +27,7 @@ var Users = require('./models/users');
27 var Timetables = require('./models/timetables'); 27 var Timetables = require('./models/timetables');
28 28
29 // Client-Browser와의 공유 29 // Client-Browser와의 공유
30 -//app.use("/static", express.static("public")); 30 +app.use("/static", express.static("public"));
31 31
32 // session 32 // session
33 app.use(session({ 33 app.use(session({
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<module type="WEB_MODULE" version="4">
3 + <component name="NewModuleRootManager">
4 + <content url="file://$MODULE_DIR$">
5 + <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6 + <excludeFolder url="file://$MODULE_DIR$/temp" />
7 + <excludeFolder url="file://$MODULE_DIR$/tmp" />
8 + </content>
9 + <orderEntry type="inheritedJdk" />
10 + <orderEntry type="sourceFolder" forTests="false" />
11 + </component>
12 +</module>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="JavaScriptSettings">
4 + <option name="languageLevel" value="ES6" />
5 + </component>
6 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="ProjectModuleManager">
4 + <modules>
5 + <module fileurl="file://$PROJECT_DIR$/.idea/example.iml" filepath="$PROJECT_DIR$/.idea/example.iml" />
6 + </modules>
7 + </component>
8 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="ChangeListManager">
4 + <list default="true" id="ad798993-023f-4135-9cdc-2f2d2c14efcb" name="Default Changelist" comment="" />
5 + <ignored path="$PROJECT_DIR$/.tmp/" />
6 + <ignored path="$PROJECT_DIR$/temp/" />
7 + <ignored path="$PROJECT_DIR$/tmp/" />
8 + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
9 + <option name="SHOW_DIALOG" value="false" />
10 + <option name="HIGHLIGHT_CONFLICTS" value="true" />
11 + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
12 + <option name="LAST_RESOLUTION" value="IGNORE" />
13 + </component>
14 + <component name="FileEditorManager">
15 + <leaf>
16 + <file pinned="false" current-in-tab="false">
17 + <entry file="file://$PROJECT_DIR$/index.html">
18 + <provider selected="true" editor-type-id="text-editor">
19 + <state>
20 + <caret selection-end-line="8" selection-end-column="7" />
21 + </state>
22 + </provider>
23 + </entry>
24 + </file>
25 + <file pinned="false" current-in-tab="true">
26 + <entry file="file://$PROJECT_DIR$/programs.html">
27 + <provider selected="true" editor-type-id="text-editor">
28 + <state relative-caret-position="494">
29 + <caret line="26" column="41" selection-start-line="26" selection-start-column="41" selection-end-line="26" selection-end-column="41" />
30 + </state>
31 + </provider>
32 + </entry>
33 + </file>
34 + <file pinned="false" current-in-tab="false">
35 + <entry file="file://$PROJECT_DIR$/mypage.html">
36 + <provider selected="true" editor-type-id="text-editor">
37 + <state relative-caret-position="285">
38 + <caret line="15" column="6" lean-forward="true" selection-start-line="10" selection-end-line="15" selection-end-column="6" />
39 + </state>
40 + </provider>
41 + </entry>
42 + </file>
43 + <file pinned="false" current-in-tab="false">
44 + <entry file="file://$PROJECT_DIR$/main.html">
45 + <provider selected="true" editor-type-id="text-editor">
46 + <state relative-caret-position="266">
47 + <caret line="14" column="94" lean-forward="true" selection-start-line="10" selection-start-column="4" selection-end-line="14" selection-end-column="94" />
48 + </state>
49 + </provider>
50 + </entry>
51 + </file>
52 + <file pinned="false" current-in-tab="false">
53 + <entry file="file://$PROJECT_DIR$/join.html">
54 + <provider selected="true" editor-type-id="text-editor">
55 + <state>
56 + <caret selection-end-line="2" selection-end-column="16" />
57 + </state>
58 + </provider>
59 + </entry>
60 + </file>
61 + </leaf>
62 + </component>
63 + <component name="IdeDocumentHistory">
64 + <option name="CHANGED_PATHS">
65 + <list>
66 + <option value="$PROJECT_DIR$/join.html" />
67 + <option value="$PROJECT_DIR$/index.html" />
68 + <option value="$PROJECT_DIR$/main.html" />
69 + <option value="$PROJECT_DIR$/mypage.html" />
70 + <option value="$PROJECT_DIR$/programs.html" />
71 + </list>
72 + </option>
73 + </component>
74 + <component name="ProjectFrameBounds">
75 + <option name="x" value="425" />
76 + <option name="y" value="39" />
77 + <option name="width" value="697" />
78 + <option name="height" value="735" />
79 + </component>
80 + <component name="ProjectView">
81 + <navigator proportions="" version="1">
82 + <foldersAlwaysOnTop value="true" />
83 + </navigator>
84 + <panes>
85 + <pane id="Scope" />
86 + <pane id="ProjectPane">
87 + <subPane>
88 + <expand>
89 + <path>
90 + <item name="example" type="b2602c69:ProjectViewProjectNode" />
91 + <item name="example" type="462c0819:PsiDirectoryNode" />
92 + </path>
93 + <path>
94 + <item name="example" type="b2602c69:ProjectViewProjectNode" />
95 + <item name="example" type="462c0819:PsiDirectoryNode" />
96 + <item name="css" type="462c0819:PsiDirectoryNode" />
97 + </path>
98 + <path>
99 + <item name="example" type="b2602c69:ProjectViewProjectNode" />
100 + <item name="example" type="462c0819:PsiDirectoryNode" />
101 + <item name="css" type="462c0819:PsiDirectoryNode" />
102 + <item name="bootstrap.css" type="620a8d5e:NestingTreeNode" />
103 + </path>
104 + <path>
105 + <item name="example" type="b2602c69:ProjectViewProjectNode" />
106 + <item name="example" type="462c0819:PsiDirectoryNode" />
107 + <item name="css" type="462c0819:PsiDirectoryNode" />
108 + <item name="bootstrap-responsive.css" type="620a8d5e:NestingTreeNode" />
109 + </path>
110 + </expand>
111 + <select />
112 + </subPane>
113 + </pane>
114 + </panes>
115 + </component>
116 + <component name="PropertiesComponent">
117 + <property name="WebServerToolWindowFactoryState" value="false" />
118 + <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
119 + <property name="nodejs_npm_path_reset_for_default_project" value="true" />
120 + </component>
121 + <component name="RecentsManager">
122 + <key name="CopyFile.RECENT_KEYS">
123 + <recent name="C:\Users\UNI\WebstormProjects\example\css" />
124 + </key>
125 + <key name="MoveFile.RECENT_KEYS">
126 + <recent name="C:\Users\UNI\WebstormProjects\example\css" />
127 + <recent name="C:\Users\UNI\WebstormProjects\example\js" />
128 + <recent name="C:\Users\UNI\WebstormProjects\example" />
129 + </key>
130 + </component>
131 + <component name="RunDashboard">
132 + <option name="ruleStates">
133 + <list>
134 + <RuleState>
135 + <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
136 + </RuleState>
137 + <RuleState>
138 + <option name="name" value="StatusDashboardGroupingRule" />
139 + </RuleState>
140 + </list>
141 + </option>
142 + </component>
143 + <component name="SvnConfiguration">
144 + <configuration />
145 + </component>
146 + <component name="TaskManager">
147 + <task active="true" id="Default" summary="Default task">
148 + <changelist id="ad798993-023f-4135-9cdc-2f2d2c14efcb" name="Default Changelist" comment="" />
149 + <created>1544532971153</created>
150 + <option name="number" value="Default" />
151 + <option name="presentableId" value="Default" />
152 + <updated>1544532971153</updated>
153 + <workItem from="1544532974007" duration="743000" />
154 + <workItem from="1544710275523" duration="2489000" />
155 + </task>
156 + <servers />
157 + </component>
158 + <component name="TimeTrackingManager">
159 + <option name="totallyTimeSpent" value="3232000" />
160 + </component>
161 + <component name="ToolWindowManager">
162 + <frame x="-7" y="0" width="697" height="735" extended-state="0" />
163 + <editor active="true" />
164 + <layout>
165 + <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24886191" />
166 + <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
167 + <window_info id="Favorites" order="2" side_tool="true" />
168 + <window_info anchor="bottom" id="Message" order="0" />
169 + <window_info anchor="bottom" id="Find" order="1" />
170 + <window_info anchor="bottom" id="Run" order="2" />
171 + <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
172 + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
173 + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
174 + <window_info anchor="bottom" id="TODO" order="6" />
175 + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
176 + <window_info anchor="bottom" id="Version Control" order="8" />
177 + <window_info anchor="bottom" id="Terminal" order="9" />
178 + <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
179 + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
180 + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
181 + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
182 + </layout>
183 + </component>
184 + <component name="TypeScriptGeneratedFilesManager">
185 + <option name="version" value="1" />
186 + </component>
187 + <component name="editorHistoryManager">
188 + <entry file="file://$PROJECT_DIR$/css/bootstrap.css">
189 + <provider selected="true" editor-type-id="text-editor">
190 + <state relative-caret-position="209">
191 + <caret line="11" column="11" lean-forward="true" selection-start-line="11" selection-start-column="11" selection-end-line="11" selection-end-column="11" />
192 + </state>
193 + </provider>
194 + </entry>
195 + <entry file="file://$PROJECT_DIR$/join.html">
196 + <provider selected="true" editor-type-id="text-editor">
197 + <state>
198 + <caret selection-end-line="2" selection-end-column="16" />
199 + </state>
200 + </provider>
201 + </entry>
202 + <entry file="file://$PROJECT_DIR$/main.html">
203 + <provider selected="true" editor-type-id="text-editor">
204 + <state relative-caret-position="266">
205 + <caret line="14" column="94" lean-forward="true" selection-start-line="10" selection-start-column="4" selection-end-line="14" selection-end-column="94" />
206 + </state>
207 + </provider>
208 + </entry>
209 + <entry file="file://$PROJECT_DIR$/index.html">
210 + <provider selected="true" editor-type-id="text-editor">
211 + <state>
212 + <caret selection-end-line="8" selection-end-column="7" />
213 + </state>
214 + </provider>
215 + </entry>
216 + <entry file="file://$PROJECT_DIR$/mypage.html">
217 + <provider selected="true" editor-type-id="text-editor">
218 + <state relative-caret-position="285">
219 + <caret line="15" column="6" lean-forward="true" selection-start-line="10" selection-end-line="15" selection-end-column="6" />
220 + </state>
221 + </provider>
222 + </entry>
223 + <entry file="file://$PROJECT_DIR$/programs.html">
224 + <provider selected="true" editor-type-id="text-editor">
225 + <state relative-caret-position="494">
226 + <caret line="26" column="41" selection-start-line="26" selection-start-column="41" selection-end-line="26" selection-end-column="41" />
227 + </state>
228 + </provider>
229 + </entry>
230 + </component>
231 +</project>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
...@@ -94,11 +94,27 @@ module.exports = function(app, Users, Timetables) ...@@ -94,11 +94,27 @@ module.exports = function(app, Users, Timetables)
94 94
95 95
96 // 동명이인 검색 페이지 96 // 동명이인 검색 페이지
97 - app.get("/samename" ,function(req, res) 97 + app.post("/samename" ,function(req, res)
98 { 98 {
99 - var samename_list = [["강호동", "https://search.pstatic.net/common?type=a&size=60x76&quality=95&src=http://sstatic.naver.net/people/portrait/201304/20130403113314207.jpg"], ["강호동", "https://search.pstatic.net/common?type=a&size=60x76&quality=95&src=http://sstatic.naver.net/people/72/201601061648058211.jpg"]]; 99 + // 크롤링으로 samename list 추출
100 - console.log("samename page"); 100 + var samename_list2 = [];
101 - res.render("samename",{samename : samename_list}); 101 + function temp(callback)
102 + {
103 + var samename_search = require("./selenium-function/same_name_search");
104 + samename_search.First_Search(req.body.samename).then(function(resolvedData)
105 + {
106 + samename_list2 = resolvedData;
107 + console.log(resolvedData);
108 + callback();
109 + });
110 + }
111 +
112 + temp(function()
113 + {
114 + console.log("samename page");
115 + //console.log(samename_list2);
116 + res.render("samename",{samename : samename_list2});
117 + });
102 }); 118 });
103 119
104 // 인물-방송정보 페이지 120 // 인물-방송정보 페이지
...@@ -130,10 +146,10 @@ module.exports = function(app, Users, Timetables) ...@@ -130,10 +146,10 @@ module.exports = function(app, Users, Timetables)
130 // 유저가 선택한 프로그램 정보 입력 146 // 유저가 선택한 프로그램 정보 입력
131 var program = new Timetables(); 147 var program = new Timetables();
132 program.user_id = req.user; 148 program.user_id = req.user;
133 - program.pname = "짠내투어"; 149 + program.pname = "아모르파티";
134 - program.pweekday = 6; 150 + program.pweekday = 5;
135 - program.start_hour = 20; 151 + program.start_hour = 10;
136 - program.start_min = 20; 152 + program.start_min = 50;
137 153
138 // DB저장 154 // DB저장
139 program.save(function(err) 155 program.save(function(err)
......
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +var options = {desiredCapabilities: {browserName: 'chrome'}};
4 +var JASON = require('jason')
5 +const {Builder, By, Key, until} = require('selenium-webdriver');
6 +var iconv = require('iconv-lite')
7 +const fs = require('fs')
8 +
9 +datalist = []
10 +
11 +module.exports = {
12 + search_onairanddate : function (driver, url, string, callback) {
13 + driver
14 + .get(url).then(() => {
15 + driver
16 + .findElements(webdriver.By.className('brcs_detail'))
17 + .then(broad_info => {
18 + broad_info[0].findElement(webdriver.By.tagName('dl'))
19 + .then(more_data => {
20 + more_data.findElement(webdriver.By.tagName('dd'))
21 + .then(one_line => {
22 + one_line.findElement(webdriver.By.className("inline"))
23 + .then(isbroad => {
24 + isbroad.findElement(webdriver.By.tagName("a"))
25 + .then(a => {
26 + a.getText()
27 + .then(text=> {
28 + isbroad.getText()
29 + .then(day => {
30 + isbroad.findElement(webdriver.By.className("broad_txt"))
31 + .then(b => {
32 + b.getText()
33 + .then(text2 => {
34 + if(day.indexOf('(') != -1) {
35 + var day_ = day[day.indexOf('(')+1]
36 + }
37 + datalist.push(text)
38 + datalist.push(text2)
39 + datalist[3] = day_
40 + setTimeout(() => {
41 + fs.writeFileSync("./log/"+string+"_br_isonair.txt", datalist, {encoding: 'utf8'});
42 +
43 + callback()
44 + }, 500);
45 + })
46 + })
47 + })
48 + })
49 + })
50 + })
51 + })
52 + })
53 + })
54 + })
55 + driver.findElement(webdriver.By.className('brcs_thumb'))
56 + .then(brcs_thumb => {
57 + brcs_thumb.findElements(webdriver.By.tagName('img'))
58 + .then( img => {
59 + img[0].getAttribute('src')
60 + .then(img_src => {
61 + datalist[2] = img_src
62 + })
63 + })
64 + })
65 + }
66 +}
67 +
68 +//
69 +//var driver = new webdriver.Builder()
70 +//.forBrowser('chrome')
71 +//.withCapabilities(webdriver.Capabilities.chrome())
72 +//.build();
73 +//
74 +//search_onairanddate(driver,"https://search.naver.com/search.naver?where=nexearch&sm=ppl_cts&mra=bjkw&x_csa=%7B%22pkid%22%3A%2257%22%2C%22os%22%3A%22659910%22%7D&pkid=57&os=659910&query=%EB%AC%B4%ED%95%9C%EB%8F%84%EC%A0%84","무한도전",function() {
75 +// console.log("B")
76 +//})
...\ No newline at end of file ...\ No newline at end of file
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +var options = {desiredCapabilities: {browserName: 'chrome'}};
4 +var onair = require('./crawling_br_onair_date')
5 +const {Builder, By, Key, until} = require('selenium-webdriver');
6 +const fs = require('fs')
7 +const screen = {
8 + width: 640,
9 + height: 480
10 +};
11 +var a=8000
12 +var img_src_list = []
13 +var text_list = []
14 +var next_link_list = []
15 +var testStartRunTime = 0;
16 +var testruntime = 0;
17 +var time = 0;
18 +module.exports = {
19 + search_broadcasting : function(driver,url,name,callback) {
20 + function testRunTimer() {
21 + var today = new Date(); // 현재시간 얻기
22 + var runTime = today.getTime(); // 밀리세컨드 ( 1970/01/01 부터 현재까지의 시간을 밀리세컨드로 나타냄 )
23 + var rtn = 0;
24 +
25 + if (testStartRunTime == 0) {
26 + testStartRunTime = runTime;
27 + } else {
28 + rtn = (runTime - testStartRunTime) / 1000;
29 + testStartRunTime = 0;
30 + }
31 + return rtn;
32 + }
33 + driver
34 + .get("http://"+url)
35 + .then(() => {
36 + driver.findElement(webdriver.By.id('pagination_76'))
37 + .then ( paginationBtn => {
38 + paginationBtn.findElements(webdriver.By.className('bt_next'))
39 + .then(Btn_next => {
40 + driver.findElement(webdriver.By.id('listUI_76'))
41 + .then(contentsUI => {
42 + clickandget(function() {
43 + Btn_next[0].click()
44 + setTimeout(() => {
45 + clickandget(function() {
46 + Btn_next[0].click()
47 + setTimeout(() => {
48 + clickandget(function() {
49 + Btn_next[0].click()
50 + setTimeout(() => {
51 + clickandget(function(){
52 + Btn_next[0].click()
53 + setTimeout(() => {
54 + clickandget(function(){
55 + fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'});
56 + fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'});
57 + setTimeout(() => {
58 + callback()
59 + }, 500);
60 + })
61 + }, testruntime*1000+800);
62 + })
63 + }, testruntime*1000+800);
64 +
65 + },testruntime*1000+800)
66 + }, testruntime*1000+800);
67 + })
68 + }, testruntime*1000+800);
69 + })
70 + function clickandget(_callback) {
71 + testRunTimer()
72 + Btn_next[0].isDisplayed().then(function(state) {
73 + if(state) {
74 + contentsUI.findElements(webdriver.By.tagName('li'))
75 + .then(elems => {
76 + elems.forEach(elem => {
77 + elem.findElement(webdriver.By.className('thmb'))
78 + .then(thmb => {
79 + thmb.getAttribute('href')
80 + .then(next_link => {
81 + thmb.findElements(webdriver.By.tagName('img'))
82 + .then(img => {
83 + img[0].getAttribute('src')
84 + .then(img_src => {
85 + elem.findElements(webdriver.By.className('tit'))
86 + .then (titles => {
87 + titles.forEach(title => {
88 + title.getText()
89 + .then(text => {
90 + text_list.push(text)
91 + img_src_list.push(img_src)
92 + next_link_list.push(next_link)
93 + if(text_list.length % 5 == 0) {
94 + var testruntime = testRunTimer();
95 + time = time+testruntime*1000
96 + _callback()
97 + }
98 + })
99 + })
100 + })
101 + })
102 + })
103 + })
104 + })
105 + })
106 + })
107 + }
108 + else {
109 + fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'});
110 + fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'});
111 + fs.writeFileSync("./log/"+name+"_next_link_br.txt", '\ufeff' + next_link_list, {encoding: 'utf8'});
112 + setTimeout(() => {
113 + callback()
114 + }, 500);
115 + }
116 + },function(err) {
117 + fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'});
118 + fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'});
119 + fs.writeFileSync("./log/"+name+"_next_link_br.txt", '\ufeff' + next_link_list, {encoding: 'utf8'});
120 + setTimeout(() => {
121 + callback()
122 + }, 500);
123 + })
124 + }
125 + })
126 + })
127 + })
128 + })
129 + function sleep (time) {
130 + return new Promise((resolve) => setTimeout(resolve, time));
131 + }
132 + }
133 +}
134 +
135 +//var driver = new webdriver.Builder()
136 +//.forBrowser('chrome')
137 +//.withCapabilities(webdriver.Capabilities.chrome())
138 +//.build();
139 +
140 +//search_broadcasting(driver,"people.search.naver.com/search.naver?where=nexearch&sm=tab_ppn&query=유재석&os=94702&ie=utf8&key=PeopleService","유재석",function() {
141 +// console.log("B")
142 +//})
...\ No newline at end of file ...\ No newline at end of file
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +var chrome = require('selenium-webdriver/chrome')
4 +var Options = new chrome.Options();
5 +Options.addArguments('headless')
6 +Options.addArguments('disable-gpu')
7 +const fs = require('fs')
8 +var check = 0
9 +var testStartRunTime = 0;
10 +var testruntime = 0;
11 +
12 +const {Builder, By, Key, until} = require('selenium-webdriver');
13 +
14 +var next_link_list = []
15 +var src_list = []
16 +var text_list = []
17 +var return_list = []
18 +
19 +module.exports = {
20 + first_search :function (driver,string,callback) {
21 +
22 + function testRunTimer() {
23 + var today = new Date(); // 현재시간 얻기
24 + var runTime = today.getTime(); // 밀리세컨드 ( 1970/01/01 부터 현재까지의 시간을 밀리세컨드로 나타냄 )
25 + var rtn = 0;
26 +
27 + if (testStartRunTime == 0) {
28 + testStartRunTime = runTime;
29 + } else {
30 + rtn = (runTime - testStartRunTime) / 1000;
31 + testStartRunTime = 0;
32 + }
33 + return rtn;
34 + }
35 + let url1 = "https://people.search.naver.com/search.naver?sm=tab_hty&where=nexearch&query="+string+"&ie=utf8&x=0&y=0"
36 + driver
37 + .get(url1).then(() => {
38 + testRunTimer()
39 + driver
40 + .findElements(webdriver.By.className('result_profile'))
41 + .then(profiles => {
42 + profiles.forEach(profile => {
43 + profile.findElements(webdriver.By.className('thmb'))
44 + .then(links=> {
45 + links.forEach(link => {
46 + link.getAttribute('href')
47 + .then(next_link => {
48 + profile.findElements(webdriver.By.className('thmb_img'))
49 + .then((imgs) => {
50 + imgs.forEach(img => {
51 + img.getAttribute('src')
52 + .then(src => {
53 + next_link_list.push(next_link)
54 + src_list.push(src)
55 + //text_list.push(text)
56 + testruntime += testRunTimer()
57 + setTimeout(function() {
58 + check++;
59 + if(check==1) {
60 + //return_list.push(text_list)
61 + setTimeout(function() {
62 + fs.writeFileSync("./log/"+string+"_next_link.txt", next_link_list, {encoding: 'utf8'});
63 + fs.writeFileSync("./log/"+string+"_img_src.txt", src_list, {encoding: 'utf8'});
64 + callback()
65 + },500)
66 + }
67 + },testruntime*1000+1000)
68 + })
69 + })
70 + })
71 + })
72 + })
73 + })
74 + })
75 + })
76 + })
77 + }
78 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var webdriver = require('selenium-webdriver');
2 +const {Builder, By, Key, until} = require('selenium-webdriver');
3 +const fs = require('fs')
4 +
5 + var arr = []
6 + var result_arr = []
7 + var temp = []
8 + var i=0
9 + var check = 0
10 +
11 +
12 +//var driver = new webdriver.Builder().forBrowser('chrome').withCapabilities(webdriver.Capabilities.chrome()).build();
13 +//search_broadcasting_time(driver,"SBS","일요일","런닝맨",function() {})
14 +module.exports = {
15 + search_broadcasting_time :function (driver,broadcast,day,findtitle, callback) {
16 + let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query="+broadcast.toLowerCase()+"+"+day+"요일"+"+편성표"
17 + driver
18 + .get(url1).then(() => {
19 + driver
20 + .findElements(webdriver.By.className('cont_inner type_day _scheduleArea'))
21 + .then(contentsearch_section=> {
22 + contentsearch_section[0].findElements(webdriver.By.tagName('tbody'))
23 + .then(tbody => {
24 + tbody[0].findElements(webdriver.By.tagName('tr'))
25 + .then(trs => {
26 + trs.forEach(tr => {
27 + tr.getText()
28 + .then(content => {
29 + if(content.indexOf(findtitle) != -1) {
30 + arr = content.toString().split('\n')
31 + console.log(arr)
32 + str(function() {
33 + i++
34 + if(i==1) {
35 + R=[]
36 + R[0] = result_arr[0]
37 + R[1] = result_arr[1]
38 + R[2] = result_arr[2]
39 + fs.writeFileSync("./log/"+findtitle+"_time_detail.txt", '\ufeff' + R, {encoding: 'utf8'});
40 + callback()
41 + }
42 + })
43 + function str(_callback) {
44 + temp[0] = arr[0].substr(0,2)
45 + temp[1] = arr[1].substr(0,2)
46 + temp[2] = findtitle
47 + result_arr.push(temp[0],temp[1],temp[2])
48 + //if(arr.length == 3) {
49 + // temp[i+2] = arr[0] + " " + arr[2].substr(0,2) + "분"
50 + // temp[i+3] = arr[2].substr(3)
51 + // result_arr.push(temp[i+2],temp[i+3])
52 + // i++
53 + //}
54 + setTimeout(() => {
55 + _callback()
56 + }, 500);
57 +
58 + }
59 + }
60 + })
61 + })
62 + })
63 + })
64 + })
65 + })
66 + }
67 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +//var options = {desiredCapabilities: {browserName: 'chrome'}};
4 +var chrome = require('selenium-webdriver/chrome')
5 +var Options = new chrome.Options();
6 +Options.addArguments('headless')
7 +Options.addArguments('disable-gpu')
8 +const fs = require('fs')
9 +const test2 = require('./crawling_broadcasting')
10 +var EventEmitter = require('events').EventEmitter;
11 +
12 +
13 +var img_src_br_list = []
14 +var title_list = []
15 +var next_link_list=[]
16 +var result_arr=[]
17 +//broadcasting_search('https://people.search.naver.com/search.naver?where=nexearch&sm=tab_ppn&query=%EC%9C%A0%EC%9E%AC%EC%84%9D&os=94702&ie=utf8&key=PeopleService','유재석')
18 +
19 +var driver_1 = new webdriver.Builder().forBrowser('chrome').withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(Options).build()
20 +
21 +module.exports = {
22 + broadcasting_search : function(next_link,name) {
23 + return new Promise(function(resolve,reject) {
24 + if(fs.existsSync("./log/"+name+"_img_src_br.txt")) {
25 + const img_src_br = fs.readFileSync("./log/"+name+"_img_src_br.txt");
26 + img_src_br_list = img_src_br.toString().split(',');
27 + const title_br = fs.readFileSync("./log/"+name+"_title_br.txt");
28 + title_list = title_br.toString().split(',');
29 + const link_br = fs.readFileSync("./log/"+name+"_next_link_br.txt")
30 + next_link_list = link_br.toString().split(',');
31 + driver_1.quit()
32 + result_arr.push(img_src_br_list,title_list,next_link_list)
33 + resolve(result_arr)
34 + }
35 + else {
36 + test2.search_broadcasting(driver_1,next_link.substr(7),name,function() {
37 + const img_src_br = fs.readFileSync("./log/"+name+"_img_src_br.txt");
38 + img_src_br_list = img_src_br.toString().split(',');
39 + const title_br = fs.readFileSync("./log/"+name+"_title_br.txt");
40 + title_list = title_br.toString().split(',');
41 + const link_br = fs.readFileSync("./log/"+name+"_next_link_br.txt")
42 + next_link_list = link_br.toString().split(',');
43 +
44 + driver_1.quit()
45 + result_arr.push(img_src_br_list,title_list,next_link_list)
46 + resolve(result_arr)
47 + })
48 + }
49 + })
50 + }
51 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +//var options = {desiredCapabilities: {browserName: 'chrome'}};
4 +var chrome = require('selenium-webdriver/chrome')
5 +var Options = new chrome.Options();
6 +Options.addArguments('headless')
7 +Options.addArguments('disable-gpu')
8 +const fs = require('fs')
9 +const test3 = require('./crawling_br_onair_date')
10 +const test4 = require('./crawling_time')
11 +var util = require('util')
12 +var EventEmitter = require('events').EventEmitter;
13 +
14 +br_datalist = []
15 +
16 +var driver_2 = new webdriver.Builder()
17 +.forBrowser('chrome')
18 +.withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(Options)
19 +.build();
20 +var returnfunction = function() {
21 + var self= this
22 + this.on('ok1',function() {
23 + return br_datalist
24 + })
25 +}
26 +var driver_3 = new webdriver.Builder()
27 +.forBrowser('chrome')
28 +.withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(Options)
29 +.build();
30 +//module.exports = {
31 + var search_detail_time = function (name) {
32 + var self = this
33 + this.on('ok',function() {
34 + if(br_datalist[1] == "방영중") {
35 + if(fs.existsSync("./log/"+name+"_time_detail.txt")) {
36 + const detail = fs.readFileSync("./log/"+name+"_time_detail.txt");
37 + detail_time_list = detail.toString().split(',');
38 + br_datalist.push(detail_time_list[0])
39 + br_datalist.push(detail_time_list[1])
40 + br_datalist.push(detail_time_list[2])
41 + }
42 + else {
43 + test4.search_broadcasting_time(driver_3,br_datalist[0],br_datalist[3],name,function(){
44 + const detail = fs.readFileSync("./log/"+name+"_time_detail.txt");
45 + detail_time_list = detail.toString().split(',');
46 + br_datalist.push(detail_time_list[0])
47 + br_datalist.push(detail_time_list[1])
48 + br_datalist.push(detail_time_list[2])
49 + })
50 + }
51 + }
52 + })
53 +
54 + }
55 +//}
56 +
57 +util.inherits(returnfunction,EventEmitter);
58 +util.inherits(search_detail_time,EventEmitter);
59 +return_ = new returnfunction();
60 +
61 +
62 +var detail_time_list = []
63 +
64 +//isonair('https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=%EB%9F%B0%EB%8B%9D%EB%A7%A8&oquery=%EB%9F%B0%EB%8B%9D%EB%A7%A8&tqi=UtvQ%2FlpySDVssa%2BpmFNssssstfG-043752',"런닝맨")
65 +module.exports = {
66 + isonair : function (url,string) {
67 + search_detail = new search_detail_time(string)
68 +
69 + return new Promise(function(resolve,reject) {
70 + if(fs.existsSync("./log/"+string+"_br_isonair.txt")) {
71 + const img_src_br = fs.readFileSync("./log/"+string+"_br_isonair.txt");
72 + br_datalist = img_src_br.toString().split(',');
73 + search_detail.emit('ok')
74 + setTimeout(() => {
75 + resolve(br_datalist)
76 + }, 5000);
77 +
78 + }
79 +
80 + else {
81 + test3.search_onairanddate(driver_2,url,string,function() {
82 + const img_src_br = fs.readFileSync("./log/"+string+"_br_isonair.txt");
83 + br_datalist = img_src_br.toString().split(',');
84 + search_detail.emit('ok')
85 + setTimeout(() => {
86 + resolve(br_datalist)
87 + }, 5000);
88 +
89 + })
90 + }
91 + })
92 + }
93 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +//var options = {desiredCapabilities: {browserName: 'chrome'}};
4 +var chrome = require('selenium-webdriver/chrome')
5 +var Options = new chrome.Options();
6 +Options.addArguments('headless')
7 +Options.addArguments('disable-gpu')
8 +var test1 = require('./crawling_samename')
9 +const fs = require('fs')
10 +var util = require('util')
11 +var EventEmitter = require('events').EventEmitter;
12 +
13 +var next_link_Array = []
14 +var img_src_Array = []
15 +
16 +const {Builder, By, Key, until} = require('selenium-webdriver');
17 +
18 +var result_arr = []
19 +module.exports = {
20 + First_Search :function(name) {
21 +
22 + var driver = new webdriver.Builder()
23 + .forBrowser('chrome')
24 + .withCapabilities(webdriver.Capabilities.chrome())
25 + //.setChromeOptions(Options)
26 + .build();
27 +
28 + return new Promise(function(resolve,reject) {
29 + if(fs.existsSync("./log/"+name+"_next_link.txt")) {
30 + const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
31 + const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
32 + next_link_Array = next_link.toString().split(',');
33 + img_src_Array = img_src.toString().split(',');
34 + //driver.quit()
35 + result_arr.push(next_link_Array)
36 + result_arr.push(img_src_Array)
37 +
38 + resolve(result_arr)
39 + }
40 + else {
41 + test1.first_search(driver,name,function() {
42 + const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
43 + const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
44 + next_link_Array = next_link.toString().split(',');
45 + img_src_Array = img_src.toString().split(',');
46 + result_arr.push(next_link_Array)
47 + result_arr.push(img_src_Array)
48 + //driver.quit()
49 + resolve(result_arr)
50 + })
51 + }
52 +
53 + })
54 +
55 + }
56 +//util.inherits(First_Search,EventEmitter);
57 +//first_search1 = new First_Search("유재석")
58 +//first_search1.emit('input')
59 +}
60 +
61 +
62 +
63 +//다른 파일에서 호출하는 방법
64 +//var a=require("./sane_name_search")
65 +
66 +//var arr = []
67 +
68 +//a.First_Search("(검색어 입력)").then(aa => {
69 +// arr=a
70 +// console.log(arr)
71 +//})
72 +
1 +var a=require("./selenium-function/last_detail")
2 +var arr = []
3 +a.isonair('https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=%EB%9F%B0%EB%8B%9D%EB%A7%A8&oquery=%EB%9F%B0%EB%8B%9D%EB%A7%A8&tqi=UtvQ%2FlpySDVssa%2BpmFNssssstfG-043752','런닝맨').then(function (resolvedData) {
4 + arr=resolvedData
5 + console.log(arr)
6 +})
7 +
8 +var b=require("./selenium-function/last")
9 +var arr_1 = []
10 +
11 +b.broadcasting_search('https://people.search.naver.com/search.naver?where=nexearch&sm=tab_ppn&query=%EC%9C%A0%EC%9E%AC%EC%84%9D&os=94702&ie=utf8&key=PeopleService','유재석').then(function(resolvedData) {
12 + arr_1 = resolvedData
13 + console.log(arr_1)
14 +})
15 +
16 +var c=require("./selenium-function/same_name_search")
17 +var arr_2 = []
18 +c.First_Search("유재석").then(function(resolvedData) {
19 + arr_2 = resolvedData
20 + console.log(arr_2)
21 +})
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
2 <form method="POST" action="/login"> 2 <form method="POST" action="/login">
3 <label>id:</label><input type="text" name="id"><br/> 3 <label>id:</label><input type="text" name="id"><br/>
4 <label>pwd:</label><input type="password" name="pwd"><br/> 4 <label>pwd:</label><input type="password" name="pwd"><br/>
5 - <button type="submit">로그인</button> 5 + <button type="submit" class="btn btn-info">로그인</button>
6 </form> 6 </form>
7 </div> 7 </div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 <label>id:</label><input type="text" name="id"><br/> 3 <label>id:</label><input type="text" name="id"><br/>
4 <label>pwd:</label><input type="password" name="pwd"><br/> 4 <label>pwd:</label><input type="password" name="pwd"><br/>
5 <label>name:</label><input type="text" name="name"><br/> 5 <label>name:</label><input type="text" name="name"><br/>
6 - <button type="submit">가입</button> 6 + <button type="submit" class="btn btn-info">가입</button>
7 </form> 7 </form>
8 - <a href='/'><button>취소</button></a> 8 + <a href='/'><button type="button" class="btn btn-danger">취소</button></a>
9 </div> 9 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 <div class="contents_main"> 1 <div class="contents_main">
2 <h1>This is main</h1> 2 <h1>This is main</h1>
3 - <form method="GET" action="/samename"> 3 + <form method="POST" action="/samename">
4 <input type="text" name="samename"> 4 <input type="text" name="samename">
5 - <button type="submit">검색</button> 5 + <button type="submit" class="btn btn-info">검색</button>
6 </form> 6 </form>
7 </div> 7 </div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 <% if(val[3] == true) { %> 8 <% if(val[3] == true) { %>
9 <li><%= val[4] %></li> 9 <li><%= val[4] %></li>
10 <li><%= val[5] %></li> 10 <li><%= val[5] %></li>
11 - <button>추가</button> 11 + <a href="/addtt"><button class="btn btn-warning">추가</button></a>
12 <% } %> 12 <% } %>
13 <% }) %> 13 <% }) %>
14 </div> 14 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 <div class="contents_main"> 1 <div class="contents_main">
2 <h1>This is Samename</h1> 2 <h1>This is Samename</h1>
3 - <% samename.forEach(function(val){ %> 3 +
4 - <li><%= val[0]%></li> 4 + <% samename[1].forEach(function(val){%>
5 - <li><img src="<%= val[1]%>"></li> 5 + <li><img src="<%-val%>"></li>
6 <% }) %> 6 <% }) %>
7 +
8 +
7 </div> 9 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Index</title> 3 <title>Index</title>
4 + <link rel="stylesheet" href="/static/css/bootstrap.css">
5 + <link rel="stylesheet" href="/static/css/site.css">
4 </head> 6 </head>
5 <body> 7 <body>
6 <% include ./navigation_index.ejs %> 8 <% include ./navigation_index.ejs %>
7 <% include ./contents_index.ejs %> 9 <% include ./contents_index.ejs %>
10 +<script src="http://ajax.googleapis.com/ajaz/libs/jquery/1.12.4/jquery.min.js"></script>
11 +<script type="text/javascript" src="/static/js/bootstrap.js"></script>
8 </body> 12 </body>
9 </html> 13 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Join</title> 3 <title>Join</title>
4 + <link rel="stylesheet" href="/static/css/bootstrap.css">
5 + <link rel="stylesheet" href="/static/css/site.css">
4 </head> 6 </head>
5 <body> 7 <body>
6 <% include ./navigation_index.ejs %> 8 <% include ./navigation_index.ejs %>
7 <% include ./contents_join.ejs %> 9 <% include ./contents_join.ejs %>
10 + <script src="http://ajax.googleapis.com/ajaz/libs/jquery/1.12.4/jquery.min.js"></script>
11 + <script type="text/javascript" src="/static/js/bootstrap.js"></script>
8 </body> 12 </body>
9 </html> 13 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Main</title> 3 <title>Main</title>
4 + <link rel="stylesheet" href="/static/css/bootstrap.css">
5 + <link rel="stylesheet" href="/static/css/site.css">
4 </head> 6 </head>
5 <body> 7 <body>
6 <% include ./navigation_main.ejs %> 8 <% include ./navigation_main.ejs %>
......
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>MyPage</title> 3 <title>MyPage</title>
4 + <link rel="stylesheet" href="/static/css/bootstrap.css">
5 + <link rel="stylesheet" href="/static/css/site.css">
4 </head> 6 </head>
5 <body> 7 <body>
6 <% include ./navigation_main.ejs %> 8 <% include ./navigation_main.ejs %>
......
1 <div class="navigation_index"> 1 <div class="navigation_index">
2 - <a href='/join'><button>회원가입</button></a> 2 + <a href='/join' ><button class="btn btn-success">회원가입</button></a>
3 - <a href='/'><button>Index</button></a> 3 + <a href='/' ><button class="btn btn-success">Index</button></a>
4 </div> 4 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 <div class="navigation_main"> 1 <div class="navigation_main">
2 - <a href="/logout"><button>로그아웃</button></a> 2 + <a href="/logout"><button class="btn btn-primary">로그아웃</button></a>
3 - <a href="/main"><button>검색</button></a> 3 + <a href="/main"><button class="btn btn-primary">검색</button></a>
4 - <a href="/mypage"><button>마이페이지</button></a> 4 + <a href="/mypage"><button class="btn btn-primary">마이페이지</button></a>
5 - <a href="/timetable"><button>나만의시간표</button></a> 5 + <a href="/timetable"><button class="btn btn-primary">나만의시간표</button></a>
6 - <a href="/ttlist"><button>시간표수정</button></a> 6 + <a href="/ttlist"><button class="btn btn-primary">시간표수정</button></a>
7 </div> 7 </div>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -5,5 +5,7 @@ ...@@ -5,5 +5,7 @@
5 <body> 5 <body>
6 <% include ./navigation_main.ejs %> 6 <% include ./navigation_main.ejs %>
7 <% include ./contents_programs.ejs %> 7 <% include ./contents_programs.ejs %>
8 + <link rel="stylesheet" href="/static/css/bootstrap.css">
9 + <link rel="stylesheet" href="/static/css/site.css">
8 </body> 10 </body>
9 </html> 11 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 <html> 1 <html>
2 <head> 2 <head>
3 <title>Samename</title> 3 <title>Samename</title>
4 + <link rel="stylesheet" href="/static/css/bootstrap.css">
5 + <link rel="stylesheet" href="/static/css/site.css">
4 </head> 6 </head>
5 <body> 7 <body>
6 <% include ./navigation_main.ejs %> 8 <% include ./navigation_main.ejs %>
......