강상위

Union with Front

......@@ -27,7 +27,7 @@ var Users = require('./models/users');
var Timetables = require('./models/timetables');
// Client-Browser와의 공유
//app.use("/static", express.static("public"));
app.use("/static", express.static("public"));
// session
app.use(session({
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/example.iml" filepath="$PROJECT_DIR$/.idea/example.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="ad798993-023f-4135-9cdc-2f2d2c14efcb" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
<ignored path="$PROJECT_DIR$/tmp/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret selection-end-line="8" selection-end-column="7" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/programs.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="494">
<caret line="26" column="41" selection-start-line="26" selection-start-column="41" selection-end-line="26" selection-end-column="41" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/mypage.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="15" column="6" lean-forward="true" selection-start-line="10" selection-end-line="15" selection-end-column="6" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="266">
<caret line="14" column="94" lean-forward="true" selection-start-line="10" selection-start-column="4" selection-end-line="14" selection-end-column="94" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/join.html">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret selection-end-line="2" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/join.html" />
<option value="$PROJECT_DIR$/index.html" />
<option value="$PROJECT_DIR$/main.html" />
<option value="$PROJECT_DIR$/mypage.html" />
<option value="$PROJECT_DIR$/programs.html" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="425" />
<option name="y" value="39" />
<option name="width" value="697" />
<option name="height" value="735" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="example" type="b2602c69:ProjectViewProjectNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="example" type="b2602c69:ProjectViewProjectNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="css" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="example" type="b2602c69:ProjectViewProjectNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="css" type="462c0819:PsiDirectoryNode" />
<item name="bootstrap.css" type="620a8d5e:NestingTreeNode" />
</path>
<path>
<item name="example" type="b2602c69:ProjectViewProjectNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="css" type="462c0819:PsiDirectoryNode" />
<item name="bootstrap-responsive.css" type="620a8d5e:NestingTreeNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\UNI\WebstormProjects\example\css" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\UNI\WebstormProjects\example\css" />
<recent name="C:\Users\UNI\WebstormProjects\example\js" />
<recent name="C:\Users\UNI\WebstormProjects\example" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="ad798993-023f-4135-9cdc-2f2d2c14efcb" name="Default Changelist" comment="" />
<created>1544532971153</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1544532971153</updated>
<workItem from="1544532974007" duration="743000" />
<workItem from="1544710275523" duration="2489000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="3232000" />
</component>
<component name="ToolWindowManager">
<frame x="-7" y="0" width="697" height="735" extended-state="0" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24886191" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/css/bootstrap.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="11" column="11" lean-forward="true" selection-start-line="11" selection-start-column="11" selection-end-line="11" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/join.html">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret selection-end-line="2" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="266">
<caret line="14" column="94" lean-forward="true" selection-start-line="10" selection-start-column="4" selection-end-line="14" selection-end-column="94" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret selection-end-line="8" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/mypage.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="15" column="6" lean-forward="true" selection-start-line="10" selection-end-line="15" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/programs.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="494">
<caret line="26" column="41" selection-start-line="26" selection-start-column="41" selection-end-line="26" selection-end-column="41" />
</state>
</provider>
</entry>
</component>
</project>
\ 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)
// 동명이인 검색 페이지
app.get("/samename" ,function(req, res)
app.post("/samename" ,function(req, res)
{
// 크롤링으로 samename list 추출
var samename_list2 = [];
function temp(callback)
{
var samename_search = require("./selenium-function/same_name_search");
samename_search.First_Search(req.body.samename).then(function(resolvedData)
{
samename_list2 = resolvedData;
console.log(resolvedData);
callback();
});
}
temp(function()
{
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"]];
console.log("samename page");
res.render("samename",{samename : samename_list});
//console.log(samename_list2);
res.render("samename",{samename : samename_list2});
});
});
// 인물-방송정보 페이지
......@@ -130,10 +146,10 @@ module.exports = function(app, Users, Timetables)
// 유저가 선택한 프로그램 정보 입력
var program = new Timetables();
program.user_id = req.user;
program.pname = "짠내투어";
program.pweekday = 6;
program.start_hour = 20;
program.start_min = 20;
program.pname = "아모르파티";
program.pweekday = 5;
program.start_hour = 10;
program.start_min = 50;
// DB저장
program.save(function(err)
......
var async = require('async');
var webdriver = require('selenium-webdriver');
var options = {desiredCapabilities: {browserName: 'chrome'}};
var JASON = require('jason')
const {Builder, By, Key, until} = require('selenium-webdriver');
var iconv = require('iconv-lite')
const fs = require('fs')
datalist = []
module.exports = {
search_onairanddate : function (driver, url, string, callback) {
driver
.get(url).then(() => {
driver
.findElements(webdriver.By.className('brcs_detail'))
.then(broad_info => {
broad_info[0].findElement(webdriver.By.tagName('dl'))
.then(more_data => {
more_data.findElement(webdriver.By.tagName('dd'))
.then(one_line => {
one_line.findElement(webdriver.By.className("inline"))
.then(isbroad => {
isbroad.findElement(webdriver.By.tagName("a"))
.then(a => {
a.getText()
.then(text=> {
isbroad.getText()
.then(day => {
isbroad.findElement(webdriver.By.className("broad_txt"))
.then(b => {
b.getText()
.then(text2 => {
if(day.indexOf('(') != -1) {
var day_ = day[day.indexOf('(')+1]
}
datalist.push(text)
datalist.push(text2)
datalist[3] = day_
setTimeout(() => {
fs.writeFileSync("./log/"+string+"_br_isonair.txt", datalist, {encoding: 'utf8'});
callback()
}, 500);
})
})
})
})
})
})
})
})
})
})
driver.findElement(webdriver.By.className('brcs_thumb'))
.then(brcs_thumb => {
brcs_thumb.findElements(webdriver.By.tagName('img'))
.then( img => {
img[0].getAttribute('src')
.then(img_src => {
datalist[2] = img_src
})
})
})
}
}
//
//var driver = new webdriver.Builder()
//.forBrowser('chrome')
//.withCapabilities(webdriver.Capabilities.chrome())
//.build();
//
//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() {
// console.log("B")
//})
\ No newline at end of file
var async = require('async');
var webdriver = require('selenium-webdriver');
var options = {desiredCapabilities: {browserName: 'chrome'}};
var onair = require('./crawling_br_onair_date')
const {Builder, By, Key, until} = require('selenium-webdriver');
const fs = require('fs')
const screen = {
width: 640,
height: 480
};
var a=8000
var img_src_list = []
var text_list = []
var next_link_list = []
var testStartRunTime = 0;
var testruntime = 0;
var time = 0;
module.exports = {
search_broadcasting : function(driver,url,name,callback) {
function testRunTimer() {
var today = new Date(); // 현재시간 얻기
var runTime = today.getTime(); // 밀리세컨드 ( 1970/01/01 부터 현재까지의 시간을 밀리세컨드로 나타냄 )
var rtn = 0;
if (testStartRunTime == 0) {
testStartRunTime = runTime;
} else {
rtn = (runTime - testStartRunTime) / 1000;
testStartRunTime = 0;
}
return rtn;
}
driver
.get("http://"+url)
.then(() => {
driver.findElement(webdriver.By.id('pagination_76'))
.then ( paginationBtn => {
paginationBtn.findElements(webdriver.By.className('bt_next'))
.then(Btn_next => {
driver.findElement(webdriver.By.id('listUI_76'))
.then(contentsUI => {
clickandget(function() {
Btn_next[0].click()
setTimeout(() => {
clickandget(function() {
Btn_next[0].click()
setTimeout(() => {
clickandget(function() {
Btn_next[0].click()
setTimeout(() => {
clickandget(function(){
Btn_next[0].click()
setTimeout(() => {
clickandget(function(){
fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'});
fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'});
setTimeout(() => {
callback()
}, 500);
})
}, testruntime*1000+800);
})
}, testruntime*1000+800);
},testruntime*1000+800)
}, testruntime*1000+800);
})
}, testruntime*1000+800);
})
function clickandget(_callback) {
testRunTimer()
Btn_next[0].isDisplayed().then(function(state) {
if(state) {
contentsUI.findElements(webdriver.By.tagName('li'))
.then(elems => {
elems.forEach(elem => {
elem.findElement(webdriver.By.className('thmb'))
.then(thmb => {
thmb.getAttribute('href')
.then(next_link => {
thmb.findElements(webdriver.By.tagName('img'))
.then(img => {
img[0].getAttribute('src')
.then(img_src => {
elem.findElements(webdriver.By.className('tit'))
.then (titles => {
titles.forEach(title => {
title.getText()
.then(text => {
text_list.push(text)
img_src_list.push(img_src)
next_link_list.push(next_link)
if(text_list.length % 5 == 0) {
var testruntime = testRunTimer();
time = time+testruntime*1000
_callback()
}
})
})
})
})
})
})
})
})
})
}
else {
fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'});
fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'});
fs.writeFileSync("./log/"+name+"_next_link_br.txt", '\ufeff' + next_link_list, {encoding: 'utf8'});
setTimeout(() => {
callback()
}, 500);
}
},function(err) {
fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'});
fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'});
fs.writeFileSync("./log/"+name+"_next_link_br.txt", '\ufeff' + next_link_list, {encoding: 'utf8'});
setTimeout(() => {
callback()
}, 500);
})
}
})
})
})
})
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
}
}
//var driver = new webdriver.Builder()
//.forBrowser('chrome')
//.withCapabilities(webdriver.Capabilities.chrome())
//.build();
//search_broadcasting(driver,"people.search.naver.com/search.naver?where=nexearch&sm=tab_ppn&query=유재석&os=94702&ie=utf8&key=PeopleService","유재석",function() {
// console.log("B")
//})
\ No newline at end of file
var async = require('async');
var webdriver = require('selenium-webdriver');
var chrome = require('selenium-webdriver/chrome')
var Options = new chrome.Options();
Options.addArguments('headless')
Options.addArguments('disable-gpu')
const fs = require('fs')
var check = 0
var testStartRunTime = 0;
var testruntime = 0;
const {Builder, By, Key, until} = require('selenium-webdriver');
var next_link_list = []
var src_list = []
var text_list = []
var return_list = []
module.exports = {
first_search :function (driver,string,callback) {
function testRunTimer() {
var today = new Date(); // 현재시간 얻기
var runTime = today.getTime(); // 밀리세컨드 ( 1970/01/01 부터 현재까지의 시간을 밀리세컨드로 나타냄 )
var rtn = 0;
if (testStartRunTime == 0) {
testStartRunTime = runTime;
} else {
rtn = (runTime - testStartRunTime) / 1000;
testStartRunTime = 0;
}
return rtn;
}
let url1 = "https://people.search.naver.com/search.naver?sm=tab_hty&where=nexearch&query="+string+"&ie=utf8&x=0&y=0"
driver
.get(url1).then(() => {
testRunTimer()
driver
.findElements(webdriver.By.className('result_profile'))
.then(profiles => {
profiles.forEach(profile => {
profile.findElements(webdriver.By.className('thmb'))
.then(links=> {
links.forEach(link => {
link.getAttribute('href')
.then(next_link => {
profile.findElements(webdriver.By.className('thmb_img'))
.then((imgs) => {
imgs.forEach(img => {
img.getAttribute('src')
.then(src => {
next_link_list.push(next_link)
src_list.push(src)
//text_list.push(text)
testruntime += testRunTimer()
setTimeout(function() {
check++;
if(check==1) {
//return_list.push(text_list)
setTimeout(function() {
fs.writeFileSync("./log/"+string+"_next_link.txt", next_link_list, {encoding: 'utf8'});
fs.writeFileSync("./log/"+string+"_img_src.txt", src_list, {encoding: 'utf8'});
callback()
},500)
}
},testruntime*1000+1000)
})
})
})
})
})
})
})
})
})
}
}
\ No newline at end of file
var webdriver = require('selenium-webdriver');
const {Builder, By, Key, until} = require('selenium-webdriver');
const fs = require('fs')
var arr = []
var result_arr = []
var temp = []
var i=0
var check = 0
//var driver = new webdriver.Builder().forBrowser('chrome').withCapabilities(webdriver.Capabilities.chrome()).build();
//search_broadcasting_time(driver,"SBS","일요일","런닝맨",function() {})
module.exports = {
search_broadcasting_time :function (driver,broadcast,day,findtitle, callback) {
let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query="+broadcast.toLowerCase()+"+"+day+"요일"+"+편성표"
driver
.get(url1).then(() => {
driver
.findElements(webdriver.By.className('cont_inner type_day _scheduleArea'))
.then(contentsearch_section=> {
contentsearch_section[0].findElements(webdriver.By.tagName('tbody'))
.then(tbody => {
tbody[0].findElements(webdriver.By.tagName('tr'))
.then(trs => {
trs.forEach(tr => {
tr.getText()
.then(content => {
if(content.indexOf(findtitle) != -1) {
arr = content.toString().split('\n')
console.log(arr)
str(function() {
i++
if(i==1) {
R=[]
R[0] = result_arr[0]
R[1] = result_arr[1]
R[2] = result_arr[2]
fs.writeFileSync("./log/"+findtitle+"_time_detail.txt", '\ufeff' + R, {encoding: 'utf8'});
callback()
}
})
function str(_callback) {
temp[0] = arr[0].substr(0,2)
temp[1] = arr[1].substr(0,2)
temp[2] = findtitle
result_arr.push(temp[0],temp[1],temp[2])
//if(arr.length == 3) {
// temp[i+2] = arr[0] + " " + arr[2].substr(0,2) + "분"
// temp[i+3] = arr[2].substr(3)
// result_arr.push(temp[i+2],temp[i+3])
// i++
//}
setTimeout(() => {
_callback()
}, 500);
}
}
})
})
})
})
})
})
}
}
\ No newline at end of file
var async = require('async');
var webdriver = require('selenium-webdriver');
//var options = {desiredCapabilities: {browserName: 'chrome'}};
var chrome = require('selenium-webdriver/chrome')
var Options = new chrome.Options();
Options.addArguments('headless')
Options.addArguments('disable-gpu')
const fs = require('fs')
const test2 = require('./crawling_broadcasting')
var EventEmitter = require('events').EventEmitter;
var img_src_br_list = []
var title_list = []
var next_link_list=[]
var result_arr=[]
//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','유재석')
var driver_1 = new webdriver.Builder().forBrowser('chrome').withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(Options).build()
module.exports = {
broadcasting_search : function(next_link,name) {
return new Promise(function(resolve,reject) {
if(fs.existsSync("./log/"+name+"_img_src_br.txt")) {
const img_src_br = fs.readFileSync("./log/"+name+"_img_src_br.txt");
img_src_br_list = img_src_br.toString().split(',');
const title_br = fs.readFileSync("./log/"+name+"_title_br.txt");
title_list = title_br.toString().split(',');
const link_br = fs.readFileSync("./log/"+name+"_next_link_br.txt")
next_link_list = link_br.toString().split(',');
driver_1.quit()
result_arr.push(img_src_br_list,title_list,next_link_list)
resolve(result_arr)
}
else {
test2.search_broadcasting(driver_1,next_link.substr(7),name,function() {
const img_src_br = fs.readFileSync("./log/"+name+"_img_src_br.txt");
img_src_br_list = img_src_br.toString().split(',');
const title_br = fs.readFileSync("./log/"+name+"_title_br.txt");
title_list = title_br.toString().split(',');
const link_br = fs.readFileSync("./log/"+name+"_next_link_br.txt")
next_link_list = link_br.toString().split(',');
driver_1.quit()
result_arr.push(img_src_br_list,title_list,next_link_list)
resolve(result_arr)
})
}
})
}
}
\ No newline at end of file
var async = require('async');
var webdriver = require('selenium-webdriver');
//var options = {desiredCapabilities: {browserName: 'chrome'}};
var chrome = require('selenium-webdriver/chrome')
var Options = new chrome.Options();
Options.addArguments('headless')
Options.addArguments('disable-gpu')
const fs = require('fs')
const test3 = require('./crawling_br_onair_date')
const test4 = require('./crawling_time')
var util = require('util')
var EventEmitter = require('events').EventEmitter;
br_datalist = []
var driver_2 = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(Options)
.build();
var returnfunction = function() {
var self= this
this.on('ok1',function() {
return br_datalist
})
}
var driver_3 = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(Options)
.build();
//module.exports = {
var search_detail_time = function (name) {
var self = this
this.on('ok',function() {
if(br_datalist[1] == "방영중") {
if(fs.existsSync("./log/"+name+"_time_detail.txt")) {
const detail = fs.readFileSync("./log/"+name+"_time_detail.txt");
detail_time_list = detail.toString().split(',');
br_datalist.push(detail_time_list[0])
br_datalist.push(detail_time_list[1])
br_datalist.push(detail_time_list[2])
}
else {
test4.search_broadcasting_time(driver_3,br_datalist[0],br_datalist[3],name,function(){
const detail = fs.readFileSync("./log/"+name+"_time_detail.txt");
detail_time_list = detail.toString().split(',');
br_datalist.push(detail_time_list[0])
br_datalist.push(detail_time_list[1])
br_datalist.push(detail_time_list[2])
})
}
}
})
}
//}
util.inherits(returnfunction,EventEmitter);
util.inherits(search_detail_time,EventEmitter);
return_ = new returnfunction();
var detail_time_list = []
//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',"런닝맨")
module.exports = {
isonair : function (url,string) {
search_detail = new search_detail_time(string)
return new Promise(function(resolve,reject) {
if(fs.existsSync("./log/"+string+"_br_isonair.txt")) {
const img_src_br = fs.readFileSync("./log/"+string+"_br_isonair.txt");
br_datalist = img_src_br.toString().split(',');
search_detail.emit('ok')
setTimeout(() => {
resolve(br_datalist)
}, 5000);
}
else {
test3.search_onairanddate(driver_2,url,string,function() {
const img_src_br = fs.readFileSync("./log/"+string+"_br_isonair.txt");
br_datalist = img_src_br.toString().split(',');
search_detail.emit('ok')
setTimeout(() => {
resolve(br_datalist)
}, 5000);
})
}
})
}
}
\ No newline at end of file
var async = require('async');
var webdriver = require('selenium-webdriver');
//var options = {desiredCapabilities: {browserName: 'chrome'}};
var chrome = require('selenium-webdriver/chrome')
var Options = new chrome.Options();
Options.addArguments('headless')
Options.addArguments('disable-gpu')
var test1 = require('./crawling_samename')
const fs = require('fs')
var util = require('util')
var EventEmitter = require('events').EventEmitter;
var next_link_Array = []
var img_src_Array = []
const {Builder, By, Key, until} = require('selenium-webdriver');
var result_arr = []
module.exports = {
First_Search :function(name) {
var driver = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(webdriver.Capabilities.chrome())
//.setChromeOptions(Options)
.build();
return new Promise(function(resolve,reject) {
if(fs.existsSync("./log/"+name+"_next_link.txt")) {
const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
next_link_Array = next_link.toString().split(',');
img_src_Array = img_src.toString().split(',');
//driver.quit()
result_arr.push(next_link_Array)
result_arr.push(img_src_Array)
resolve(result_arr)
}
else {
test1.first_search(driver,name,function() {
const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
next_link_Array = next_link.toString().split(',');
img_src_Array = img_src.toString().split(',');
result_arr.push(next_link_Array)
result_arr.push(img_src_Array)
//driver.quit()
resolve(result_arr)
})
}
})
}
//util.inherits(First_Search,EventEmitter);
//first_search1 = new First_Search("유재석")
//first_search1.emit('input')
}
//다른 파일에서 호출하는 방법
//var a=require("./sane_name_search")
//var arr = []
//a.First_Search("(검색어 입력)").then(aa => {
// arr=a
// console.log(arr)
//})
var a=require("./selenium-function/last_detail")
var arr = []
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) {
arr=resolvedData
console.log(arr)
})
var b=require("./selenium-function/last")
var arr_1 = []
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) {
arr_1 = resolvedData
console.log(arr_1)
})
var c=require("./selenium-function/same_name_search")
var arr_2 = []
c.First_Search("유재석").then(function(resolvedData) {
arr_2 = resolvedData
console.log(arr_2)
})
\ No newline at end of file
......@@ -2,6 +2,6 @@
<form method="POST" action="/login">
<label>id:</label><input type="text" name="id"><br/>
<label>pwd:</label><input type="password" name="pwd"><br/>
<button type="submit">로그인</button>
<button type="submit" class="btn btn-info">로그인</button>
</form>
</div>
\ No newline at end of file
......
......@@ -3,7 +3,7 @@
<label>id:</label><input type="text" name="id"><br/>
<label>pwd:</label><input type="password" name="pwd"><br/>
<label>name:</label><input type="text" name="name"><br/>
<button type="submit">가입</button>
<button type="submit" class="btn btn-info">가입</button>
</form>
<a href='/'><button>취소</button></a>
<a href='/'><button type="button" class="btn btn-danger">취소</button></a>
</div>
\ No newline at end of file
......
<div class="contents_main">
<h1>This is main</h1>
<form method="GET" action="/samename">
<form method="POST" action="/samename">
<input type="text" name="samename">
<button type="submit">검색</button>
<button type="submit" class="btn btn-info">검색</button>
</form>
</div>
\ No newline at end of file
......
......@@ -8,7 +8,7 @@
<% if(val[3] == true) { %>
<li><%= val[4] %></li>
<li><%= val[5] %></li>
<button>추가</button>
<a href="/addtt"><button class="btn btn-warning">추가</button></a>
<% } %>
<% }) %>
</div>
\ No newline at end of file
......
<div class="contents_main">
<h1>This is Samename</h1>
<% samename.forEach(function(val){ %>
<li><%= val[0]%></li>
<li><img src="<%= val[1]%>"></li>
<% samename[1].forEach(function(val){%>
<li><img src="<%-val%>"></li>
<% }) %>
</div>
\ No newline at end of file
......
<html>
<head>
<title>Index</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<link rel="stylesheet" href="/static/css/site.css">
</head>
<body>
<% include ./navigation_index.ejs %>
<% include ./contents_index.ejs %>
<script src="http://ajax.googleapis.com/ajaz/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.js"></script>
</body>
</html>
\ No newline at end of file
......
<html>
<head>
<title>Join</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<link rel="stylesheet" href="/static/css/site.css">
</head>
<body>
<% include ./navigation_index.ejs %>
<% include ./contents_join.ejs %>
<script src="http://ajax.googleapis.com/ajaz/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.js"></script>
</body>
</html>
\ No newline at end of file
......
<html>
<head>
<title>Main</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<link rel="stylesheet" href="/static/css/site.css">
</head>
<body>
<% include ./navigation_main.ejs %>
......
<html>
<head>
<title>MyPage</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<link rel="stylesheet" href="/static/css/site.css">
</head>
<body>
<% include ./navigation_main.ejs %>
......
<div class="navigation_index">
<a href='/join'><button>회원가입</button></a>
<a href='/'><button>Index</button></a>
<a href='/join' ><button class="btn btn-success">회원가입</button></a>
<a href='/' ><button class="btn btn-success">Index</button></a>
</div>
\ No newline at end of file
......
<div class="navigation_main">
<a href="/logout"><button>로그아웃</button></a>
<a href="/main"><button>검색</button></a>
<a href="/mypage"><button>마이페이지</button></a>
<a href="/timetable"><button>나만의시간표</button></a>
<a href="/ttlist"><button>시간표수정</button></a>
<a href="/logout"><button class="btn btn-primary">로그아웃</button></a>
<a href="/main"><button class="btn btn-primary">검색</button></a>
<a href="/mypage"><button class="btn btn-primary">마이페이지</button></a>
<a href="/timetable"><button class="btn btn-primary">나만의시간표</button></a>
<a href="/ttlist"><button class="btn btn-primary">시간표수정</button></a>
</div>
\ No newline at end of file
......
......@@ -5,5 +5,7 @@
<body>
<% include ./navigation_main.ejs %>
<% include ./contents_programs.ejs %>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<link rel="stylesheet" href="/static/css/site.css">
</body>
</html>
\ No newline at end of file
......
<html>
<head>
<title>Samename</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
<link rel="stylesheet" href="/static/css/site.css">
</head>
<body>
<% include ./navigation_main.ejs %>
......