feat: 뽐뿌 인기 게시물 감지 로직 추가

- tr.baseList 선택으로 변경하여 인기 게시물 감지
- hotpop_bg_color 클래스로 인기 여부 판단
- HotDeal 생성 시 isPopular 값 설정

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
sanjeok77
2026-03-11 21:37:14 +09:00
parent 674b696421
commit fd58995802

View File

@@ -51,20 +51,27 @@ class PpomppuScraper(client: OkHttpClient) : BaseScraper(client) {
val deals = mutableListOf<HotDeal>() val deals = mutableListOf<HotDeal>()
// 셀렉터로 요소 찾기 // 셀렉터로 요소 찾기 - 인기 게시물 감지를 위해 tr 요소 선택
val elements: Elements = doc.select("a.baseList-title") val rowElements: Elements = doc.select("tr.baseList")
Log.d("Ppomppu", "찾은 요소: ${elements.size}") Log.d("Ppomppu", "찾은 요소: ${rowElements.size}")
// 최대 20개까지만 처리 // 최대 20개까지만 처리
var count = 0 var count = 0
elements.forEach { element -> rowElements.forEach { row ->
if (count >= 20) return@forEach if (count >= 20) return@forEach
try { try {
val title = element.text().trim() // 인기 게시물 여부 확인 (hotpop_bg_color 클래스 존재 여부)
val isPopular = row.hasClass("hotpop_bg_color")
// 제목 링크 찾기
val titleElement = row.selectFirst("a.baseList-title")
if (titleElement == null) return@forEach
val title = titleElement.text().trim()
if (title.isEmpty()) return@forEach if (title.isEmpty()) return@forEach
val href = element.attr("href") val href = titleElement.attr("href")
// 공지사항 제외 // 공지사항 제외
if (href.contains("regulation") || href.contains("notice")) return@forEach if (href.contains("regulation") || href.contains("notice")) return@forEach
@@ -84,11 +91,13 @@ class PpomppuScraper(client: OkHttpClient) : BaseScraper(client) {
boardName = board, boardName = board,
title = title, title = title,
url = dealUrl, url = dealUrl,
createdAt = System.currentTimeMillis() createdAt = System.currentTimeMillis(),
isPopular = isPopular
) )
deals.add(deal) deals.add(deal)
count++ count++
Log.d("Ppomppu", "[$count] $title") val popularMark = if (isPopular) " [인기]" else ""
Log.d("Ppomppu", "[$count]$popularMark $title")
} catch (e: Exception) { } catch (e: Exception) {
Log.e("Ppomppu", "파싱 에러: ${e.message}") Log.e("Ppomppu", "파싱 에러: ${e.message}")
} }