From 9d809a1bbb27f7361ba2c2efa572cbc931a7f73c Mon Sep 17 00:00:00 2001 From: in-seo Date: Sun, 23 Oct 2022 21:33:39 +0900 Subject: [PATCH] hotfix: hola service --- .../main/java/Matching/SouP/crawler/Hola/HolaService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SouP/src/main/java/Matching/SouP/crawler/Hola/HolaService.java b/SouP/src/main/java/Matching/SouP/crawler/Hola/HolaService.java index 711bce3..1ba9705 100644 --- a/SouP/src/main/java/Matching/SouP/crawler/Hola/HolaService.java +++ b/SouP/src/main/java/Matching/SouP/crawler/Hola/HolaService.java @@ -41,10 +41,10 @@ public void getHolaPostData(){ Elements element = doc.select("#root > main > div.mainContent_appWrapper___CgAh > ul"); log.info("훌라 크롤링 시작, 가장 최신글번호 = {}",standard); int count = element.select(">a").size(); - for (int i = count; i >0; i--) { + for (int i = count; i >1; i--) { if(i==count){ scroll((JavascriptExecutor) driver); - driver.findElement(By.cssSelector("#root > main > div.mainContent_appWrapper___CgAh > ul > a:nth-child(1)")).click(); + driver.findElement(By.cssSelector("#root > main > div.mainContent_appWrapper___CgAh > ul > a:nth-child(2)")).click(); String first = driver.getCurrentUrl().substring(27); if(first.compareTo(standard)<=0) { log.warn("사이트 내 가장 최신글 번호 = {}, 따라서 불러올 글이 없습니다!",first); @@ -86,8 +86,8 @@ public void getHolaPostData(){ log.warn("불러올 글이 없습니다!"); else log.info("홀라 크롤링 성공"); - }catch (Exception e) { - e.printStackTrace(); + }catch (StringIndexOutOfBoundsException | InterruptedException e) { + log.error("잘못된 파싱. substring 실패"); } finally { driver.close(); // 브라우저 종료 }