Skip to content

Commit

Permalink
hotfix: okky xss path selector
Browse files Browse the repository at this point in the history
  • Loading branch information
in-seo committed Jan 12, 2025
1 parent 76ca224 commit 8b3bc52
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.openqa.selenium.WebDriver;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -35,11 +36,11 @@ public void getOkkyPostData() {
driver.get(urlOkky + "?page=" + Page);
String html = driver.getPageSource();
Document doc = Jsoup.parse(html);
for (int i = 23; i > 4; i--) { //오래된 글부터 크롤링 그럼 반드시 최신글은 DB에서 가장 밑에꺼임.
if(i==10) // 공지, 광고 제거
continue;
Elements element = doc.select("#__next > main > div > div:nth-child(2) > div > div:nth-child(5) > div > ul > li:nth-child(" + i + ")");
Elements elements = doc.select("#__next > main > div > div:nth-child(2) > div > div:nth-child(5) > div > ul > li[class*='py']");
for (int i = elements.size() - 1; i >= 0; i--) {
Element element = elements.get(i);
Elements title = element.select("div > div.my-2 > a");
// 여기서 각 element에 대한 처리를 진행
String postName = title.text();
String num;
try {
Expand Down

0 comments on commit 8b3bc52

Please sign in to comment.