김대선

KakaoFunction.js 수정 및 puppeteer timeouterror 수정

......@@ -32,24 +32,19 @@ const makeObject = (array)=>{
return result
}
const moveNextPage = async (page)=>{
await page.click('#mArticle > div > div.paging_list > span > a:nth-child(10) > span > span').catch((error)=>{
})
await page.waitForTimeout(1000)
return await page.content()
}
const getData = async ()=>{
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setDefaultNavigationTimeout(0)
let result = []
let temp = ""
let count = 1
await page.goto('https://careers.kakao.com/jobs')
let content = await page.content()
let content = ""
while(true){
await page.goto(`https://careers.kakao.com/jobs?page=${count}`)
content = await page.content()
if(temp == content){
break;
}
......@@ -66,12 +61,12 @@ const getData = async ()=>{
resArr.pop()
result = result.concat(await makeObject(resArr))
temp = content
content = await moveNextPage(page)
count = count + 1
}
console.log("kakao : ", result.length)
return result
}
module.exports = {
getData : getData
}
......
......@@ -40,6 +40,7 @@ const makeObject = (array)=>{
const getData = async ()=>{
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setDefaultNavigationTimeout(0)
await page.goto('https://recruit.navercorp.com/naver/job/list/developer')
let content = await page.content()
......@@ -66,6 +67,7 @@ const getData = async ()=>{
})
resArr = result.split('</li><li>')
result = makeObject(resArr)
console.log("naver : ", result.length)
return result;
}
......
......@@ -43,6 +43,7 @@ const makeObject = (array)=>{
const getData = async ()=>{
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setDefaultNavigationTimeout(0)
let result = []
let temp = ""
......