Showing
1 changed file
with
12 additions
and
5 deletions
... | @@ -44,16 +44,21 @@ const getData = async ()=>{ | ... | @@ -44,16 +44,21 @@ const getData = async ()=>{ |
44 | 44 | ||
45 | await page.goto('https://recruit.navercorp.com/naver/job/list/developer') | 45 | await page.goto('https://recruit.navercorp.com/naver/job/list/developer') |
46 | let content = await page.content() | 46 | let content = await page.content() |
47 | - let temp = null; | 47 | + let temp = ""; |
48 | - while(true){ | 48 | + let Flag = true |
49 | - if (temp == content) break; | 49 | + while(Flag){ |
50 | + if (temp == content){ | ||
51 | + Flag = false | ||
52 | + break; | ||
53 | + } | ||
50 | else{ | 54 | else{ |
51 | - temp = await page.content() | 55 | + temp = content |
52 | await page.click('#moreDiv > button').catch((error)=>{ | 56 | await page.click('#moreDiv > button').catch((error)=>{ |
53 | - | 57 | + Flag = false |
54 | }) | 58 | }) |
55 | await page.waitForTimeout(1500) | 59 | await page.waitForTimeout(1500) |
56 | content = await page.content() | 60 | content = await page.content() |
61 | + | ||
57 | } | 62 | } |
58 | } | 63 | } |
59 | let $ = cheerio.load(content, {decodeEntities: true}) | 64 | let $ = cheerio.load(content, {decodeEntities: true}) |
... | @@ -74,3 +79,5 @@ const getData = async ()=>{ | ... | @@ -74,3 +79,5 @@ const getData = async ()=>{ |
74 | module.exports = { | 79 | module.exports = { |
75 | getData : getData | 80 | getData : getData |
76 | } | 81 | } |
82 | + | ||
83 | +getData() | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment