Showing
7 changed files
with
294 additions
and
96 deletions
... | @@ -4,9 +4,12 @@ var options = {desiredCapabilities: {browserName: 'chrome'}}; | ... | @@ -4,9 +4,12 @@ var options = {desiredCapabilities: {browserName: 'chrome'}}; |
4 | var JASON = require('jason') | 4 | var JASON = require('jason') |
5 | const {Builder, By, Key, until} = require('selenium-webdriver'); | 5 | const {Builder, By, Key, until} = require('selenium-webdriver'); |
6 | var iconv = require('iconv-lite') | 6 | var iconv = require('iconv-lite') |
7 | +const fs = require('fs') | ||
8 | + | ||
9 | +datalist = [] | ||
7 | 10 | ||
8 | module.exports = { | 11 | module.exports = { |
9 | - search_onairanddate: function(driver,string) { | 12 | + search_onairanddate: function(driver,string,callback) { |
10 | let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=" + string | 13 | let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=" + string |
11 | driver | 14 | driver |
12 | .get(url1).then(() => { | 15 | .get(url1).then(() => { |
... | @@ -21,39 +24,29 @@ module.exports = { | ... | @@ -21,39 +24,29 @@ module.exports = { |
21 | .then(isbroad => { | 24 | .then(isbroad => { |
22 | isbroad.getText() | 25 | isbroad.getText() |
23 | .then(isbroad_string => { | 26 | .then(isbroad_string => { |
24 | - console.log(isbroad_string) | ||
25 | broadcasting=isbroad_string.substring(0,4) | 27 | broadcasting=isbroad_string.substring(0,4) |
26 | isbroad = isbroad_string.substring(18,21) | 28 | isbroad = isbroad_string.substring(18,21) |
27 | br_date = isbroad_string.substring(23,24) | 29 | br_date = isbroad_string.substring(23,24) |
28 | br_date = br_date + "요일" | 30 | br_date = br_date + "요일" |
29 | br_time = isbroad_string.substring(26,34) | 31 | br_time = isbroad_string.substring(26,34) |
32 | + datalist.push(broadcasting,isbroad,br_date,br_time) | ||
30 | 33 | ||
31 | - console.log(broadcasting,isbroad,br_date,br_time) | 34 | + fs.writeFileSync("./log/"+string+"_br_isonair.txt", '\ufeff' + datalist, {encoding: 'utf8'}); |
32 | - if(isbroad == "방영중") { | ||
33 | - driver.findElement(webdriver.By.id('nx_query')).clear().then(( )=> { | ||
34 | - //var buf = iconv.encode("편성표", "euc-kr") | ||
35 | - //console.log(buf) | ||
36 | - //var encodestr=''; | ||
37 | - //for(var i=0; i<buf.length;i++) { | ||
38 | - // encodestr+='%'+buf[i].toString('16') | ||
39 | - // } | ||
40 | - //encodestr = encodestr.toUpperCase(); | ||
41 | - //console.log(iconv.encode(encodestr, 'EUC-KR').toString()) | ||
42 | - //console.log(encodestr) | ||
43 | - //var buf = iconv.encode('편성표','euckr') | ||
44 | - //var param = buf.toString('binary') | ||
45 | - //console.log(param) | ||
46 | - //driver.findElement(webdriver.By.id('nx_query')).sendKeys(broadcasting,br_date,param) | ||
47 | - //driver.findElement(webdriver.By.className('spnew ico_search')).click() | ||
48 | - }) | ||
49 | - | ||
50 | - } | ||
51 | - else { | ||
52 | 35 | ||
53 | - } | 36 | + callback() |
37 | + }) | ||
38 | + }) | ||
39 | + }) | ||
54 | }) | 40 | }) |
55 | }) | 41 | }) |
56 | }) | 42 | }) |
43 | + driver.findElement(webdriver.By.className('brcs_thumb')) | ||
44 | + .then(brcs_thumb => { | ||
45 | + brcs_thumb.findElements(webdriver.By.tagName('img')) | ||
46 | + .then( img => { | ||
47 | + img[0].getAttribute('src') | ||
48 | + .then(img_src => { | ||
49 | + datalist.push(img_src) | ||
57 | }) | 50 | }) |
58 | }) | 51 | }) |
59 | }) | 52 | }) | ... | ... |
... | @@ -2,16 +2,34 @@ var async = require('async'); | ... | @@ -2,16 +2,34 @@ var async = require('async'); |
2 | var webdriver = require('selenium-webdriver'); | 2 | var webdriver = require('selenium-webdriver'); |
3 | var options = {desiredCapabilities: {browserName: 'chrome'}}; | 3 | var options = {desiredCapabilities: {browserName: 'chrome'}}; |
4 | const {Builder, By, Key, until} = require('selenium-webdriver'); | 4 | const {Builder, By, Key, until} = require('selenium-webdriver'); |
5 | +const fs = require('fs') | ||
5 | const screen = { | 6 | const screen = { |
6 | width: 640, | 7 | width: 640, |
7 | height: 480 | 8 | height: 480 |
8 | }; | 9 | }; |
9 | -var a=0 | 10 | +var a=8000 |
10 | -var breaktheloop = false | 11 | +var img_src_list = [] |
12 | +var text_list = [] | ||
13 | +var testStartRunTime = 0; | ||
14 | +var testruntime = 0; | ||
15 | +var time = 0; | ||
11 | module.exports = { | 16 | module.exports = { |
12 | - search_broadcasting : function(driver,url) { | 17 | + search_broadcasting :function(driver,url,name,callback) { |
18 | + function testRunTimer() { | ||
19 | + var today = new Date(); // 현재시간 얻기 | ||
20 | + var runTime = today.getTime(); // 밀리세컨드 ( 1970/01/01 부터 현재까지의 시간을 밀리세컨드로 나타냄 ) | ||
21 | + var rtn = 0; | ||
22 | + | ||
23 | + if (testStartRunTime == 0) { | ||
24 | + testStartRunTime = runTime; | ||
25 | + } else { | ||
26 | + rtn = (runTime - testStartRunTime) / 1000; | ||
27 | + testStartRunTime = 0; | ||
28 | + } | ||
29 | + return rtn; | ||
30 | + } | ||
13 | driver | 31 | driver |
14 | - .get(url) | 32 | + .get("http://"+url) |
15 | .then(() => { | 33 | .then(() => { |
16 | driver.findElement(webdriver.By.id('pagination_76')) | 34 | driver.findElement(webdriver.By.id('pagination_76')) |
17 | .then ( paginationBtn => { | 35 | .then ( paginationBtn => { |
... | @@ -19,56 +37,95 @@ module.exports = { | ... | @@ -19,56 +37,95 @@ module.exports = { |
19 | .then(Btn_next => { | 37 | .then(Btn_next => { |
20 | driver.findElement(webdriver.By.id('listUI_76')) | 38 | driver.findElement(webdriver.By.id('listUI_76')) |
21 | .then(contentsUI => { | 39 | .then(contentsUI => { |
22 | - contentsUI.findElements(webdriver.By.tagName('li')) | 40 | + clickandget(function() { |
23 | - .then(elems => { | 41 | + Btn_next[0].click() |
24 | - elems.forEach(elem => { | 42 | + setTimeout(() => { |
25 | - elem.getText() | 43 | + clickandget(function() { |
26 | - .then(text => { | 44 | + Btn_next[0].click() |
27 | - console.log(text) | 45 | + setTimeout(() => { |
46 | + clickandget(function() { | ||
47 | + Btn_next[0].click() | ||
48 | + setTimeout(() => { | ||
49 | + clickandget(function(){ | ||
50 | + Btn_next[0].click() | ||
51 | + setTimeout(() => { | ||
52 | + clickandget(function(){ | ||
53 | + fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'}); | ||
54 | + fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'}); | ||
55 | + setTimeout(() => { | ||
56 | + callback() | ||
57 | + }, 500); | ||
58 | + }) | ||
59 | + }, testruntime*1000+800); | ||
28 | }) | 60 | }) |
61 | + }, testruntime*1000+800); | ||
62 | + | ||
63 | + },testruntime*1000+800) | ||
64 | + }, testruntime*1000+800); | ||
29 | }) | 65 | }) |
66 | + }, testruntime*1000+800); | ||
30 | }) | 67 | }) |
31 | - clickandget() | 68 | + function clickandget(_callback) { |
32 | - function clickandget() { | 69 | + testRunTimer() |
33 | Btn_next[0].isDisplayed().then(function(state) { | 70 | Btn_next[0].isDisplayed().then(function(state) { |
34 | if(state) { | 71 | if(state) { |
35 | - Btn_next[0].click() | ||
36 | - sleep(500).then(()=> { | ||
37 | contentsUI.findElements(webdriver.By.tagName('li')) | 72 | contentsUI.findElements(webdriver.By.tagName('li')) |
38 | .then(elems => { | 73 | .then(elems => { |
39 | elems.forEach(elem => { | 74 | elems.forEach(elem => { |
40 | - elem.getText() | 75 | + elem.findElements(webdriver.By.tagName('img')) |
76 | + .then(img => { | ||
77 | + img[0].getAttribute('src') | ||
78 | + .then(img_src => { | ||
79 | + elem.findElements(webdriver.By.className('tit')) | ||
80 | + .then (titles => { | ||
81 | + titles.forEach(title => { | ||
82 | + title.getText() | ||
41 | .then(text => { | 83 | .then(text => { |
42 | - console.log(text) | 84 | + text_list.push(text) |
85 | + img_src_list.push(img_src) | ||
86 | + if(text_list.length % 5 == 0) { | ||
87 | + var testruntime = testRunTimer(); | ||
88 | + time = time+testruntime*1000 | ||
89 | + _callback() | ||
90 | + } | ||
91 | + }) | ||
92 | + }) | ||
93 | + }) | ||
43 | }) | 94 | }) |
44 | }) | 95 | }) |
45 | }) | 96 | }) |
46 | }) | 97 | }) |
47 | } | 98 | } |
48 | else { | 99 | else { |
49 | - console.log(state) | 100 | + fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'}); |
101 | + fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'}); | ||
102 | + setTimeout(() => { | ||
103 | + callback() | ||
104 | + }, 500); | ||
50 | } | 105 | } |
106 | + },function(err) { | ||
107 | + fs.writeFileSync("./log/"+name+"_img_src_br.txt", '\ufeff' + img_src_list, {encoding: 'utf8'}); | ||
108 | + fs.writeFileSync("./log/"+name+"_title_br.txt", '\ufeff' + text_list, {encoding: 'utf8'}); | ||
109 | + setTimeout(() => { | ||
110 | + callback() | ||
111 | + }, 500); | ||
51 | }) | 112 | }) |
52 | } | 113 | } |
53 | }) | 114 | }) |
54 | }) | 115 | }) |
55 | }) | 116 | }) |
56 | }) | 117 | }) |
57 | - | ||
58 | - function getContentsandClickNext(callback) { | ||
59 | - driver.findElement(webdriver.By.id('listUI_76')) | ||
60 | - .then(contentsUI => { | ||
61 | - contentsUI.findElements(webdriver.By.tagName('li')) | ||
62 | - .then(elems => { | ||
63 | - elems.forEach(elem => { | ||
64 | - elem.getTex | ||
65 | - }) | ||
66 | - }) | ||
67 | - }) | ||
68 | - } | ||
69 | - | ||
70 | function sleep (time) { | 118 | function sleep (time) { |
71 | return new Promise((resolve) => setTimeout(resolve, time)); | 119 | return new Promise((resolve) => setTimeout(resolve, time)); |
72 | } | 120 | } |
73 | } | 121 | } |
74 | } | 122 | } |
123 | + | ||
124 | +//var driver = new webdriver.Builder() | ||
125 | +//.forBrowser('chrome') | ||
126 | +//.withCapabilities(webdriver.Capabilities.chrome()) | ||
127 | +//.build(); | ||
128 | + | ||
129 | +//search_broadcasting(driver,"people.search.naver.com/search.naver?where=nexearch&sm=tab_ppn&query=유재석&os=94702&ie=utf8&key=PeopleService","유재석",function() { | ||
130 | +// console.log("B") | ||
131 | +//}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | var async = require('async'); | 1 | var async = require('async'); |
2 | var webdriver = require('selenium-webdriver'); | 2 | var webdriver = require('selenium-webdriver'); |
3 | -//var options = {desiredCapabilities: {browserName: 'chrome'}}; | ||
4 | var chrome = require('selenium-webdriver/chrome') | 3 | var chrome = require('selenium-webdriver/chrome') |
5 | var Options = new chrome.Options(); | 4 | var Options = new chrome.Options(); |
6 | Options.addArguments('headless') | 5 | Options.addArguments('headless') |
7 | Options.addArguments('disable-gpu') | 6 | Options.addArguments('disable-gpu') |
8 | -//var JASON = require('jason') | 7 | +const fs = require('fs') |
9 | -//var util = require('util') | ||
10 | -//var EventEmitter = require('events') | ||
11 | var check = 0 | 8 | var check = 0 |
12 | var testStartRunTime = 0; | 9 | var testStartRunTime = 0; |
13 | var testruntime = 0; | 10 | var testruntime = 0; |
... | @@ -18,8 +15,9 @@ var next_link_list = [] | ... | @@ -18,8 +15,9 @@ var next_link_list = [] |
18 | var src_list = [] | 15 | var src_list = [] |
19 | var text_list = [] | 16 | var text_list = [] |
20 | var return_list = [] | 17 | var return_list = [] |
18 | + | ||
21 | module.exports = { | 19 | module.exports = { |
22 | - first_search : function(driver,string) { | 20 | + first_search :function (driver,string,callback) { |
23 | 21 | ||
24 | function testRunTimer() { | 22 | function testRunTimer() { |
25 | var today = new Date(); // 현재시간 얻기 | 23 | var today = new Date(); // 현재시간 얻기 |
... | @@ -52,32 +50,21 @@ module.exports = { | ... | @@ -52,32 +50,21 @@ module.exports = { |
52 | imgs.forEach(img => { | 50 | imgs.forEach(img => { |
53 | img.getAttribute('src') | 51 | img.getAttribute('src') |
54 | .then(src => { | 52 | .then(src => { |
55 | - profile.findElements(webdriver.By.className('who')) | ||
56 | - .then(whos => { | ||
57 | - whos.forEach(who => { | ||
58 | - who.getText() | ||
59 | - .then(text => { | ||
60 | next_link_list.push(next_link) | 53 | next_link_list.push(next_link) |
61 | src_list.push(src) | 54 | src_list.push(src) |
62 | - text_list.push(text) | 55 | + //text_list.push(text) |
63 | testruntime += testRunTimer() | 56 | testruntime += testRunTimer() |
64 | - console.log(testruntime) | ||
65 | setTimeout(function() { | 57 | setTimeout(function() { |
66 | check++; | 58 | check++; |
67 | if(check==1) { | 59 | if(check==1) { |
68 | - return_list.push(next_link_list) | 60 | + //return_list.push(text_list) |
69 | - return_list.push(src_list) | ||
70 | - return_list.push(text_list) | ||
71 | - console.log(testruntime) | ||
72 | setTimeout(function() { | 61 | setTimeout(function() { |
73 | - console.log(return_list) | 62 | + fs.writeFileSync("./log/"+string+"_next_link.txt", '\ufeff' + next_link_list, {encoding: 'utf8'}); |
74 | - return return_list | 63 | + fs.writeFileSync("./log/"+string+"_img_src.txt", '\ufeff' + src_list, {encoding: 'utf8'}); |
64 | + callback() | ||
75 | },500) | 65 | },500) |
76 | } | 66 | } |
77 | - },testruntime+1000) | 67 | + },testruntime*1000+1000) |
78 | - }) | ||
79 | - }) | ||
80 | - }) | ||
81 | }) | 68 | }) |
82 | }) | 69 | }) |
83 | }) | 70 | }) |
... | @@ -89,4 +76,3 @@ module.exports = { | ... | @@ -89,4 +76,3 @@ module.exports = { |
89 | }) | 76 | }) |
90 | } | 77 | } |
91 | } | 78 | } |
... | \ No newline at end of file | ... | \ No newline at end of file |
92 | - | ... | ... |
1 | -var async = require('async'); | ||
2 | var webdriver = require('selenium-webdriver'); | 1 | 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'); | 2 | const {Builder, By, Key, until} = require('selenium-webdriver'); |
6 | -var iconv = require('iconv-lite') | 3 | +const fs = require('fs') |
7 | - | ||
8 | 4 | ||
5 | + var arr = [] | ||
6 | + var result_arr = [] | ||
7 | + var temp = [] | ||
8 | + var i=0 | ||
9 | + var check = 0 | ||
9 | module.exports = { | 10 | module.exports = { |
10 | - search_broadcasting_time : function(driver,broadcast,day,findtitle) { | 11 | + search_broadcasting_time : function(driver,broadcast,day,findtitle, callback) { |
11 | let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=0&ie=utf8&query="+broadcast+"+"+day+"+편성표" | 12 | let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=0&ie=utf8&query="+broadcast+"+"+day+"+편성표" |
12 | driver | 13 | driver |
13 | .get(url1).then(() => { | 14 | .get(url1).then(() => { |
... | @@ -22,7 +23,29 @@ module.exports = { | ... | @@ -22,7 +23,29 @@ module.exports = { |
22 | tr.getText() | 23 | tr.getText() |
23 | .then(content => { | 24 | .then(content => { |
24 | if(content.indexOf(findtitle) != -1) { | 25 | if(content.indexOf(findtitle) != -1) { |
25 | - console.log(content) | 26 | + arr = content.toString().split('\n') |
27 | + str(function() { | ||
28 | + i++ | ||
29 | + if(i==2) { | ||
30 | + fs.writeFileSync("./log/"+findtitle+"_time_detail.txt", '\ufeff' + result_arr, {encoding: 'utf8'}); | ||
31 | + callback() | ||
32 | + } | ||
33 | + }) | ||
34 | + function str(_callback) { | ||
35 | + temp[i+0] = arr[0] + " " + arr[1].substr(0,2) + "분" | ||
36 | + temp[i+1] = arr[1].substr(3) | ||
37 | + result_arr.push(temp[i+0],temp[i+1]) | ||
38 | + if(arr.length == 3) { | ||
39 | + temp[i+2] = arr[0] + " " + arr[2].substr(0,2) + "분" | ||
40 | + temp[i+3] = arr[2].substr(3) | ||
41 | + result_arr.push(temp[i+2],temp[i+3]) | ||
42 | + i++ | ||
43 | + } | ||
44 | + setTimeout(() => { | ||
45 | + _callback() | ||
46 | + }, 500); | ||
47 | + | ||
48 | + } | ||
26 | } | 49 | } |
27 | }) | 50 | }) |
28 | }) | 51 | }) | ... | ... |
... | @@ -6,10 +6,16 @@ var Options = new chrome.Options(); | ... | @@ -6,10 +6,16 @@ var Options = new chrome.Options(); |
6 | Options.addArguments('headless') | 6 | Options.addArguments('headless') |
7 | Options.addArguments('disable-gpu') | 7 | Options.addArguments('disable-gpu') |
8 | var JASON = require('jason') | 8 | var JASON = require('jason') |
9 | -const test1 = require('./crawling_samename') | 9 | +var test1 = require('./crawling_samename') |
10 | +const fs = require('fs') | ||
10 | const test2 = require('./crawling_broadcasting') | 11 | const test2 = require('./crawling_broadcasting') |
11 | const test3 = require('./crawling_br_onair_date') | 12 | const test3 = require('./crawling_br_onair_date') |
12 | const test4 = require('./crawling_time') | 13 | const test4 = require('./crawling_time') |
14 | +var util = require('util') | ||
15 | +var EventEmitter = require('events').EventEmitter; | ||
16 | + | ||
17 | +var next_link_Array = [] | ||
18 | +var img_src_Array = [] | ||
13 | 19 | ||
14 | const {Builder, By, Key, until} = require('selenium-webdriver'); | 20 | const {Builder, By, Key, until} = require('selenium-webdriver'); |
15 | var driver = new webdriver.Builder() | 21 | var driver = new webdriver.Builder() |
... | @@ -17,31 +23,143 @@ var driver = new webdriver.Builder() | ... | @@ -17,31 +23,143 @@ var driver = new webdriver.Builder() |
17 | .withCapabilities(webdriver.Capabilities.chrome()) | 23 | .withCapabilities(webdriver.Capabilities.chrome()) |
18 | .setChromeOptions(Options) | 24 | .setChromeOptions(Options) |
19 | .build(); | 25 | .build(); |
20 | -samename_list = [] | ||
21 | -samename_list = test1.first_search(driver,"유재석") | ||
22 | 26 | ||
23 | var driver_1 = new webdriver.Builder() | 27 | var driver_1 = new webdriver.Builder() |
24 | .forBrowser('chrome') | 28 | .forBrowser('chrome') |
25 | .withCapabilities(webdriver.Capabilities.chrome()) | 29 | .withCapabilities(webdriver.Capabilities.chrome()) |
26 | .setChromeOptions(Options) | 30 | .setChromeOptions(Options) |
27 | -.build(); | 31 | +.build() |
28 | - | ||
29 | -test2.search_broadcasting(driver_1,"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") | ||
30 | - | ||
31 | - | ||
32 | var driver_2 = new webdriver.Builder() | 32 | var driver_2 = new webdriver.Builder() |
33 | .forBrowser('chrome') | 33 | .forBrowser('chrome') |
34 | .withCapabilities(webdriver.Capabilities.chrome()) | 34 | .withCapabilities(webdriver.Capabilities.chrome()) |
35 | .setChromeOptions(Options) | 35 | .setChromeOptions(Options) |
36 | .build(); | 36 | .build(); |
37 | 37 | ||
38 | -test3.search_onairanddate(driver_2,"런닝맨") | ||
39 | - | ||
40 | - | ||
41 | var driver_3 = new webdriver.Builder() | 38 | var driver_3 = new webdriver.Builder() |
42 | .forBrowser('chrome') | 39 | .forBrowser('chrome') |
43 | .withCapabilities(webdriver.Capabilities.chrome()) | 40 | .withCapabilities(webdriver.Capabilities.chrome()) |
44 | .setChromeOptions(Options) | 41 | .setChromeOptions(Options) |
45 | .build(); | 42 | .build(); |
43 | +var First_Search = function(name) { | ||
44 | + var self=this; | ||
45 | + this.on('input', function() { | ||
46 | + | ||
47 | + if(fs.existsSync("./log/"+name+"_next_link.txt")) { | ||
48 | + const next_link = fs.readFileSync("./log/"+name+"_next_link.txt"); | ||
49 | + const img_src = fs.readFileSync("./log/"+name+"_img_src.txt"); | ||
50 | + next_link_Array = next_link.toString().split(','); | ||
51 | + img_src_Array = img_src.toString().split(','); | ||
52 | + driver.quit() | ||
53 | + console.log(next_link_Array) | ||
54 | + console.log(img_src_Array) | ||
55 | + | ||
56 | + setTimeout(function() { | ||
57 | + br_search.emit('click') | ||
58 | + },1000) | ||
59 | + | ||
60 | + } | ||
61 | + else { | ||
62 | + test1.first_search(driver,name,function() { | ||
63 | + const next_link = fs.readFileSync("./log/"+name+"_next_link.txt"); | ||
64 | + const img_src = fs.readFileSync("./log/"+name+"_img_src.txt"); | ||
65 | + next_link_Array = next_link.toString().split(','); | ||
66 | + img_src_Array = img_src.toString().split(','); | ||
67 | + br_search = new broadcasting_search(next_link_Array,"유재석",0) | ||
68 | + console.log(next_link_Array) | ||
69 | + console.log(img_src_Array) | ||
70 | + driver.quit() | ||
71 | + setTimeout(function() { | ||
72 | + br_search.emit('click') | ||
73 | + },1000) | ||
74 | + }) | ||
75 | + } | ||
76 | + }) | ||
77 | +} | ||
78 | +util.inherits(First_Search,EventEmitter); | ||
79 | +first_search1 = new First_Search("유재석") | ||
80 | +first_search1.emit('input') | ||
81 | + | ||
82 | +var img_src_br_list = [] | ||
83 | +var title_list = [] | ||
84 | +var broadcasting_search = function(next_link,name,num) { | ||
85 | + var self=this; | ||
86 | + this.on('click', function() { | ||
87 | + if(fs.existsSync("./log/"+name+"_img_src_br.txt")) { | ||
88 | + const img_src_br = fs.readFileSync("./log/"+name+"_img_src_br.txt"); | ||
89 | + img_src_br_list = img_src_br.toString().split(','); | ||
90 | + const title_br = fs.readFileSync("./log/"+name+"_title_br.txt"); | ||
91 | + title_list = title_br.toString().split(','); | ||
92 | + driver_1.quit() | ||
93 | + console.log(img_src_br_list) | ||
94 | + console.log(title_list) | ||
95 | + is_onair.emit('click_1') | ||
96 | + } | ||
97 | + else { | ||
98 | + test2.search_broadcasting(driver_1,next_link[num].substr(9),name,function() { | ||
99 | + const img_src_br = fs.readFileSync("./log/"+name+"_img_src_br.txt"); | ||
100 | + img_src_br_list = img_src_br.toString().split(','); | ||
101 | + const title_br = fs.readFileSync("./log/"+name+"_title_br.txt"); | ||
102 | + title_list = title_br.toString().split(','); | ||
103 | + | ||
104 | + driver_1.quit() | ||
105 | + console.log(img_src_br_list) | ||
106 | + console.log(title_list) | ||
107 | + is_onair.emit('click_1') | ||
108 | + }) | ||
109 | + } | ||
110 | + }) | ||
111 | +} | ||
112 | +util.inherits(broadcasting_search,EventEmitter); | ||
113 | +br_search = new broadcasting_search(next_link_Array,"유재석",0) | ||
114 | + | ||
115 | +br_datalist = [] | ||
116 | +var isonair = function(num) { | ||
117 | + var self = this | ||
118 | + this.on('click_1',function() { | ||
119 | + if(fs.existsSync("./log/"+title_list[num]+"_br_isonair.txt")) { | ||
120 | + const img_src_br = fs.readFileSync("./log/"+title_list[num]+"_br_isonair.txt"); | ||
121 | + br_datalist = img_src_br.toString().split(','); | ||
122 | + br_datalist[0] = br_datalist[0].trim() | ||
123 | + console.log(br_datalist) | ||
124 | + Search_detail_time.emit('click_2') | ||
125 | + } | ||
126 | + | ||
127 | + else { | ||
128 | + test3.search_onairanddate(driver_2,title_list[num],function() { | ||
129 | + const img_src_br = fs.readFileSync("./log/"+title_list[num]+"_br_isonair.txt"); | ||
130 | + br_datalist = img_src_br.toString().split(','); | ||
131 | + br_datalist[0] = br_datalist[0].trim() | ||
132 | + console.log(br_datalist) | ||
133 | + Search_detail_time.emit('click_2') | ||
134 | + }) | ||
135 | + } | ||
136 | + }) | ||
137 | +} | ||
138 | + | ||
139 | +util.inherits(isonair,EventEmitter); | ||
140 | +is_onair = new isonair(11) | ||
141 | + | ||
142 | +var detail_time_list = [] | ||
143 | +var search_detail_time = function(num) { | ||
144 | + var self = this; | ||
145 | + this.on('click_2',function() { | ||
146 | + if(br_datalist[1] == "방영중") { | ||
147 | + if(fs.existsSync("./log/"+title_list[num]+"_time_detail.txt")) { | ||
148 | + const detail = fs.readFileSync("./log/"+title_list[num]+"_time_detail.txt"); | ||
149 | + detail_time_list = detail.toString().split(','); | ||
150 | + console.log(detail_time_list) | ||
151 | + } | ||
152 | + else { | ||
153 | + test4.search_broadcasting_time(driver_3,br_datalist[0],br_datalist[2],title_list[num],function(){ | ||
154 | + const detail = fs.readFileSync("./log/"+title_list[num]+"_time_detail.txt"); | ||
155 | + detail_time_list = detail.toString().split(','); | ||
156 | + console.log(detail_time_list) | ||
157 | + }) | ||
158 | + | ||
159 | + } | ||
160 | + } | ||
161 | + }) | ||
162 | +} | ||
46 | 163 | ||
47 | -test4.search_broadcasting_time(driver_3,"SBS","일요일","런닝맨") | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
164 | +util.inherits(search_detail_time,EventEmitter); | ||
165 | +Search_detail_time = new search_detail_time(11); | ... | ... |
... | @@ -493,6 +493,11 @@ | ... | @@ -493,6 +493,11 @@ |
493 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", | 493 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
494 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" | 494 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" |
495 | }, | 495 | }, |
496 | + "events": { | ||
497 | + "version": "3.0.0", | ||
498 | + "resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz", | ||
499 | + "integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==" | ||
500 | + }, | ||
496 | "extend": { | 501 | "extend": { |
497 | "version": "3.0.2", | 502 | "version": "3.0.2", |
498 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", | 503 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", |
... | @@ -556,6 +561,11 @@ | ... | @@ -556,6 +561,11 @@ |
556 | "mime-types": "^2.1.12" | 561 | "mime-types": "^2.1.12" |
557 | } | 562 | } |
558 | }, | 563 | }, |
564 | + "fs": { | ||
565 | + "version": "0.0.1-security", | ||
566 | + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", | ||
567 | + "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" | ||
568 | + }, | ||
559 | "fs-constants": { | 569 | "fs-constants": { |
560 | "version": "1.0.0", | 570 | "version": "1.0.0", |
561 | "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", | 571 | "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", |
... | @@ -1291,6 +1301,14 @@ | ... | @@ -1291,6 +1301,14 @@ |
1291 | } | 1301 | } |
1292 | } | 1302 | } |
1293 | }, | 1303 | }, |
1304 | + "util": { | ||
1305 | + "version": "0.11.1", | ||
1306 | + "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", | ||
1307 | + "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", | ||
1308 | + "requires": { | ||
1309 | + "inherits": "2.0.3" | ||
1310 | + } | ||
1311 | + }, | ||
1294 | "util-deprecate": { | 1312 | "util-deprecate": { |
1295 | "version": "1.0.2", | 1313 | "version": "1.0.2", |
1296 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", | 1314 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", | ... | ... |
... | @@ -10,10 +10,13 @@ | ... | @@ -10,10 +10,13 @@ |
10 | "license": "ISC", | 10 | "license": "ISC", |
11 | "dependencies": { | 11 | "dependencies": { |
12 | "async": "^2.6.1", | 12 | "async": "^2.6.1", |
13 | + "events": "^3.0.0", | ||
14 | + "fs": "0.0.1-security", | ||
13 | "iconv-lite": "^0.4.24", | 15 | "iconv-lite": "^0.4.24", |
14 | "jason": "^2.0.0", | 16 | "jason": "^2.0.0", |
15 | "json": "^9.0.6", | 17 | "json": "^9.0.6", |
16 | "selenium-webdriver": "^3.6.0", | 18 | "selenium-webdriver": "^3.6.0", |
19 | + "util": "^0.11.1", | ||
17 | "webdriverio": "^4.14.0" | 20 | "webdriverio": "^4.14.0" |
18 | } | 21 | } |
19 | } | 22 | } | ... | ... |
-
Please register or login to post a comment