김승훈

add crawling_samename_person

var async = require('async');
var webdriver = require('selenium-webdriver');
var options = {desiredCapabilities: {browserName: 'chrome'}};
var JASON = require('jason')
const {Builder, By, Key, until} = require('selenium-webdriver');
var ajason = new Object()
var aname = []
var asrc=[]
var alink=[]
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
let url1 = "https://people.search.naver.com/search.naver?sm=sbx_hty&where=nexearch&ie=utf8&query=%EC%9C%A0%EC%9E%AC%EC%84%9D&x=0&y=0"
driver
.get(url1).then(() => {
driver
.findElements(webdriver.By.className('result_profile'))
.then(whoclasses=> {
whoclasses.forEach(whoclass => {
whoclass.findElements(webdriver.By.className('thmb'))
.then(img_thmbs => {
img_thmbs.forEach(img_thmb => {
img_thmb.findElements(webdriver.By.className('thmb_img')).then(img_src => {
img_src[0].getAttribute("src")
.then(src => {
if(src) {
asrc.push(src)
}
else {
asrc.push("none")
}
}).then(() => {
console.log(asrc,alink,aname)
})
})
})
whoclass.findElements(webdriver.By.tagName("strong"))
.then(name_temp => {
name_temp[0].getText().then(name => {
aname.push(name)
})
})
})
whoclass.findElements(webdriver.By.className('who'))
.then(who => {
who[0].findElements(webdriver.By.className('name'))
.then(findname => {
findname[0].getAttribute("href")
.then(link => {
alink.push(link)
})
})
})
})
})
})
\ No newline at end of file