김승훈

동일인물검색 업데이트

...@@ -20,23 +20,23 @@ var driver = new webdriver.Builder() ...@@ -20,23 +20,23 @@ var driver = new webdriver.Builder()
20 .setChromeOptions(Options) 20 .setChromeOptions(Options)
21 .build(); 21 .build();
22 22
23 -var First_Search = function(name) { 23 +var result_arr = []
24 - var self=this; 24 +module.exports = {
25 - this.on('input', function() { 25 + First_Search :function(name) {
26 - 26 + return new Promise(function(resolve,reject) {
27 if(fs.existsSync("./log/"+name+"_next_link.txt")) { 27 if(fs.existsSync("./log/"+name+"_next_link.txt")) {
28 const next_link = fs.readFileSync("./log/"+name+"_next_link.txt"); 28 const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
29 const img_src = fs.readFileSync("./log/"+name+"_img_src.txt"); 29 const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
30 next_link_Array = next_link.toString().split(','); 30 next_link_Array = next_link.toString().split(',');
31 img_src_Array = img_src.toString().split(','); 31 img_src_Array = img_src.toString().split(',');
32 driver.quit() 32 driver.quit()
33 + result_arr.push(next_link_Array)
34 + result_arr.push(img_src_Array)
33 console.log(next_link_Array) 35 console.log(next_link_Array)
34 console.log(img_src_Array) 36 console.log(img_src_Array)
37 + console.log(result_arr)
35 38
36 - setTimeout(function() { 39 + return result_arr
37 - br_search.emit('click')
38 - },1000)
39 -
40 } 40 }
41 else { 41 else {
42 test1.first_search(driver,name,function() { 42 test1.first_search(driver,name,function() {
...@@ -45,16 +45,32 @@ var First_Search = function(name) { ...@@ -45,16 +45,32 @@ var First_Search = function(name) {
45 next_link_Array = next_link.toString().split(','); 45 next_link_Array = next_link.toString().split(',');
46 img_src_Array = img_src.toString().split(','); 46 img_src_Array = img_src.toString().split(',');
47 br_search = new broadcasting_search(next_link_Array,"유재석",0) 47 br_search = new broadcasting_search(next_link_Array,"유재석",0)
48 + result_arr.push(next_link_Array)
49 + result_arr.push(img_src_Array)
48 console.log(next_link_Array) 50 console.log(next_link_Array)
49 console.log(img_src_Array) 51 console.log(img_src_Array)
50 driver.quit() 52 driver.quit()
51 - setTimeout(function() { 53 + return result_arr
52 - br_search.emit('click')
53 - },1000)
54 }) 54 })
55 } 55 }
56 +
56 }) 57 })
58 +
59 + }
60 +//util.inherits(First_Search,EventEmitter);
61 +//first_search1 = new First_Search("유재석")
62 +//first_search1.emit('input')
57 } 63 }
58 -util.inherits(First_Search,EventEmitter); 64 +
59 -first_search1 = new First_Search("유재석") 65 +
60 -first_search1.emit('input') 66 +
67 +//다른 파일에서 호출하는 방법
68 +//var a=require("./sane_name_search")
69 +
70 +//var arr = []
71 +
72 +//a.First_Search("(검색어 입력)").then(aa => {
73 +// arr=a
74 +// console.log(arr)
75 +//})
76 +
......