Skip to content

Commit

Permalink
hotfix: okky 크롤링 구조 변환(3) (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
in-seo authored Nov 23, 2023
2 parents 4d61370 + f25e7f8 commit 6b3f291
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void getOkkyPostData() {
String html = driver.getPageSource();
Document doc = Jsoup.parse(html);
for (int i = 28; i > 0; i--) { //오래된 글부터 크롤링 그럼 반드시 최신글은 DB에서 가장 밑에꺼임.
Elements element = doc.select("#__next > main > div > div:nth-child(2) > div > div:nth-child(6) > div > ul > li.py-4:nth-child(" + i + ")");
Elements element = doc.select("#__next > main > div > div:nth-child(2) > div > div:nth-child(5) > div > ul > li.py-4:nth-child(" + i + ")");
Elements title = element.select("div > div.my-2 > a");
String postName = title.text();
String num;
Expand Down Expand Up @@ -101,7 +101,7 @@ private int startPage(WebDriver driver, int start) throws StringIndexOutOfBounds
Document doc = Jsoup.parse(html);
int num = Integer.MAX_VALUE;
try {
String sNum = doc.select("#__next > main > div > div:nth-child(2) > div > div:nth-child(6) > div > ul > li:nth-child("+cnt+") > div > div.my-2 > a").attr("href").substring(10);//각 페이지 첫 글
String sNum = doc.select("#__next > main > div > div:nth-child(2) > div > div:nth-child(5) > div > ul > li:nth-child("+cnt+") > div > div.my-2 > a").attr("href").substring(10);//각 페이지 첫 글
num = Integer.parseInt(sNum);
}catch (StringIndexOutOfBoundsException | NullPointerException e){
cnt++;
Expand Down

0 comments on commit 6b3f291

Please sign in to comment.