김승훈

update main

...@@ -5,10 +5,9 @@ var JASON = require('jason') ...@@ -5,10 +5,9 @@ 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 7
8 -var driver = new webdriver.Builder(). 8 +module.exports = {
9 - withCapabilities(webdriver.Capabilities.chrome()). 9 + search_onairanddate: function(driver,string) {
10 - build(); 10 + let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=" + string
11 - let url1 = "https://search.naver.com/search.naver?sm=top_hty&fbm=1&ie=utf8&query=%EB%9F%B0%EB%8B%9D%EB%A7%A8"
12 driver 11 driver
13 .get(url1).then(() => { 12 .get(url1).then(() => {
14 driver 13 driver
...@@ -41,11 +40,11 @@ var driver = new webdriver.Builder(). ...@@ -41,11 +40,11 @@ var driver = new webdriver.Builder().
41 //encodestr = encodestr.toUpperCase(); 40 //encodestr = encodestr.toUpperCase();
42 //console.log(iconv.encode(encodestr, 'EUC-KR').toString()) 41 //console.log(iconv.encode(encodestr, 'EUC-KR').toString())
43 //console.log(encodestr) 42 //console.log(encodestr)
44 - var buf = iconv.encode('편성표','euckr') 43 + //var buf = iconv.encode('편성표','euckr')
45 - var param = buf.toString('binary') 44 + //var param = buf.toString('binary')
46 - console.log(param) 45 + //console.log(param)
47 - driver.findElement(webdriver.By.id('nx_query')).sendKeys(broadcasting,br_date,param) 46 + //driver.findElement(webdriver.By.id('nx_query')).sendKeys(broadcasting,br_date,param)
48 - driver.findElement(webdriver.By.className('spnew ico_search')).click() 47 + //driver.findElement(webdriver.By.className('spnew ico_search')).click()
49 }) 48 })
50 49
51 } 50 }
...@@ -58,3 +57,5 @@ var driver = new webdriver.Builder(). ...@@ -58,3 +57,5 @@ var driver = new webdriver.Builder().
58 }) 57 })
59 }) 58 })
60 }) 59 })
60 + }
61 +}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -8,13 +8,8 @@ const screen = { ...@@ -8,13 +8,8 @@ const screen = {
8 }; 8 };
9 var a=0 9 var a=0
10 var breaktheloop = false 10 var breaktheloop = false
11 -var driver = new webdriver.Builder(). 11 +module.exports = {
12 - withCapabilities(webdriver.Capabilities.chrome()). 12 + search_broadcasting : function(driver,url) {
13 - build();
14 -
15 -
16 -
17 - let url = 'https://people.search.naver.com/search.naver?where=nexearch&query=%EC%9C%A0%EC%9E%AC%EC%84%9D&sm=tab_etc&ie=utf8&key=PeopleService&os=94702';
18 driver 13 driver
19 .get(url) 14 .get(url)
20 .then(() => { 15 .then(() => {
...@@ -75,3 +70,5 @@ var driver = new webdriver.Builder(). ...@@ -75,3 +70,5 @@ var driver = new webdriver.Builder().
75 function sleep (time) { 70 function sleep (time) {
76 return new Promise((resolve) => setTimeout(resolve, time)); 71 return new Promise((resolve) => setTimeout(resolve, time));
77 } 72 }
73 + }
74 +}
...\ No newline at end of file ...\ No newline at end of file
......
This diff is collapsed. Click to expand it.
...@@ -5,11 +5,10 @@ var JASON = require('jason') ...@@ -5,11 +5,10 @@ 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 7
8 -var findtitle = "런닝맨" 8 +
9 -var driver = new webdriver.Builder(). 9 +module.exports = {
10 - withCapabilities(webdriver.Capabilities.chrome()). 10 + search_broadcasting_time : function(driver,broadcast,day,findtitle) {
11 - build(); 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=tab_hty.top&where=nexearch&query=SBS+%EC%9D%BC%EC%9A%94%EC%9D%BC+%ED%8E%B8%EC%84%B1%ED%91%9C&oquery=SBS+%EC%9B%94%EC%9A%94%EC%9D%BC+%ED%8E%B8%EC%84%B1%ED%91%9C&tqi=UsDTSlpySD0ssv33OfVssssssXK-499490"
13 driver 12 driver
14 .get(url1).then(() => { 13 .get(url1).then(() => {
15 driver 14 driver
...@@ -31,3 +30,5 @@ var driver = new webdriver.Builder(). ...@@ -31,3 +30,5 @@ var driver = new webdriver.Builder().
31 }) 30 })
32 }) 31 })
33 }) 32 })
33 + }
34 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 +var async = require('async');
2 +var webdriver = require('selenium-webdriver');
3 +//var options = {desiredCapabilities: {browserName: 'chrome'}};
4 +var chrome = require('selenium-webdriver/chrome')
5 +var Options = new chrome.Options();
6 +Options.addArguments('headless')
7 +Options.addArguments('disable-gpu')
8 +var JASON = require('jason')
9 +const test1 = require('./crawling_samename')
10 +const test2 = require('./crawling_broadcasting')
11 +const test3 = require('./crawling_br_onair_date')
12 +const test4 = require('./crawling_time')
13 +
14 +const {Builder, By, Key, until} = require('selenium-webdriver');
15 +var driver = new webdriver.Builder()
16 +.forBrowser('chrome')
17 +.withCapabilities(webdriver.Capabilities.chrome())
18 +.setChromeOptions(Options)
19 +.build();
20 +samename_list = []
21 +samename_list = test1.first_search(driver,"유재석")
22 +
23 +var driver_1 = new webdriver.Builder()
24 +.forBrowser('chrome')
25 +.withCapabilities(webdriver.Capabilities.chrome())
26 +.setChromeOptions(Options)
27 +.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()
33 +.forBrowser('chrome')
34 +.withCapabilities(webdriver.Capabilities.chrome())
35 +.setChromeOptions(Options)
36 +.build();
37 +
38 +test3.search_onairanddate(driver_2,"런닝맨")
39 +
40 +
41 +var driver_3 = new webdriver.Builder()
42 +.forBrowser('chrome')
43 +.withCapabilities(webdriver.Capabilities.chrome())
44 +.setChromeOptions(Options)
45 +.build();
46 +
47 +test4.search_broadcasting_time(driver_3,"SBS","일요일","런닝맨")
...\ No newline at end of file ...\ No newline at end of file