김승훈

동일인물검색 업데이트

......@@ -20,41 +20,57 @@ var driver = new webdriver.Builder()
.setChromeOptions(Options)
.build();
var First_Search = function(name) {
var self=this;
this.on('input', function() {
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()
console.log(next_link_Array)
console.log(img_src_Array)
setTimeout(function() {
br_search.emit('click')
},1000)
}
else {
test1.first_search(driver,name,function() {
var result_arr = []
module.exports = {
First_Search :function(name) {
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(',');
br_search = new broadcasting_search(next_link_Array,"유재석",0)
driver.quit()
result_arr.push(next_link_Array)
result_arr.push(img_src_Array)
console.log(next_link_Array)
console.log(img_src_Array)
driver.quit()
setTimeout(function() {
br_search.emit('click')
},1000)
})
}
})
console.log(result_arr)
return 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(',');
br_search = new broadcasting_search(next_link_Array,"유재석",0)
result_arr.push(next_link_Array)
result_arr.push(img_src_Array)
console.log(next_link_Array)
console.log(img_src_Array)
driver.quit()
return result_arr
})
}
})
}
//util.inherits(First_Search,EventEmitter);
//first_search1 = new First_Search("유재석")
//first_search1.emit('input')
}
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)
//})
......