김승훈

동일인물검색 업데이트

...@@ -20,41 +20,57 @@ var driver = new webdriver.Builder() ...@@ -20,41 +20,57 @@ 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");
29 - const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
30 - next_link_Array = next_link.toString().split(',');
31 - img_src_Array = img_src.toString().split(',');
32 - driver.quit()
33 - console.log(next_link_Array)
34 - console.log(img_src_Array)
35 -
36 - setTimeout(function() {
37 - br_search.emit('click')
38 - },1000)
39 -
40 - }
41 - else {
42 - test1.first_search(driver,name,function() {
43 const next_link = fs.readFileSync("./log/"+name+"_next_link.txt"); 28 const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
44 const img_src = fs.readFileSync("./log/"+name+"_img_src.txt"); 29 const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
45 next_link_Array = next_link.toString().split(','); 30 next_link_Array = next_link.toString().split(',');
46 img_src_Array = img_src.toString().split(','); 31 img_src_Array = img_src.toString().split(',');
47 - br_search = new broadcasting_search(next_link_Array,"유재석",0) 32 + driver.quit()
33 + result_arr.push(next_link_Array)
34 + result_arr.push(img_src_Array)
48 console.log(next_link_Array) 35 console.log(next_link_Array)
49 console.log(img_src_Array) 36 console.log(img_src_Array)
50 - driver.quit() 37 + console.log(result_arr)
51 - setTimeout(function() { 38 +
52 - br_search.emit('click') 39 + return result_arr
53 - },1000) 40 + }
54 - }) 41 + else {
55 - } 42 + test1.first_search(driver,name,function() {
56 - }) 43 + const next_link = fs.readFileSync("./log/"+name+"_next_link.txt");
44 + const img_src = fs.readFileSync("./log/"+name+"_img_src.txt");
45 + next_link_Array = next_link.toString().split(',');
46 + img_src_Array = img_src.toString().split(',');
47 + br_search = new broadcasting_search(next_link_Array,"유재석",0)
48 + result_arr.push(next_link_Array)
49 + result_arr.push(img_src_Array)
50 + console.log(next_link_Array)
51 + console.log(img_src_Array)
52 + driver.quit()
53 + return result_arr
54 + })
55 + }
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 +
......