From e9b192eabbf2a5013afdefdae6130e423842b0c9 Mon Sep 17 00:00:00 2001 From: "hehihoho3@gmail.com" Date: Fri, 26 Jun 2026 10:49:42 +0900 Subject: [PATCH] =?UTF-8?q?feat(discover):=20=EC=B6=94=EC=B2=9C=20?= =?UTF-8?q?=EC=B1=84=EB=84=90=20=EC=A0=84=EC=9A=A9=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20/recommend=20+=20=EC=82=AC=EC=9D=B4=EB=93=9C?= =?UTF-8?q?=EB=B0=94=20+=20=EB=B0=9C=EA=B5=B4=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EC=88=98=EC=88=9C=20=EB=B3=B4=EA=B0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - recommend.html(카드: 썸네일·구독자·배율·대표영상, 등록/제외) + WebController 라우트 + 사이드바 메뉴 - 발굴 검색 order=viewCount 강제(키워드 없을 때 최신순→조회수순) — 떡상 채널이 잡히게 (YoutubeSearchCondition.order 추가, YoutubeSearchService 반영) 검증: /run → KR,JP,US 26개 떡상 채널 발굴(구독 76~7천, 배율 1500~9만x). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../channel/ChannelDiscoveryService.java | 1 + .../service/YoutubeSearchService.java | 4 +- .../com/hlab/yanalyst/web/WebController.java | 6 ++ .../web/dto/YoutubeSearchCondition.java | 1 + .../resources/templates/layout/sidebar.html | 3 + src/main/resources/templates/recommend.html | 68 +++++++++++++++++++ 6 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/templates/recommend.html diff --git a/src/main/java/com/hlab/yanalyst/domain/channel/ChannelDiscoveryService.java b/src/main/java/com/hlab/yanalyst/domain/channel/ChannelDiscoveryService.java index f72fd38..e20e521 100644 --- a/src/main/java/com/hlab/yanalyst/domain/channel/ChannelDiscoveryService.java +++ b/src/main/java/com/hlab/yanalyst/domain/channel/ChannelDiscoveryService.java @@ -59,6 +59,7 @@ public class ChannelDiscoveryService { cond.setRegions(List.of(region)); cond.setFormat("SHORTS"); cond.setPeriodDays(periodDays); + cond.setOrder("viewCount"); // 떡상 발굴: 최신순이 아니라 조회수순 // 광범위 검색: 키워드 없이 인기 Shorts. 결과 빈약 시 검색 API 보강 필요(스펙 §4.2). YoutubeSearchPageDto page = youtubeSearchService.searchYoutubeVideos(cond); if (page != null && page.getItems() != null) all.addAll(page.getItems()); diff --git a/src/main/java/com/hlab/yanalyst/service/YoutubeSearchService.java b/src/main/java/com/hlab/yanalyst/service/YoutubeSearchService.java index 1f728ac..3499277 100644 --- a/src/main/java/com/hlab/yanalyst/service/YoutubeSearchService.java +++ b/src/main/java/com/hlab/yanalyst/service/YoutubeSearchService.java @@ -59,7 +59,9 @@ public class YoutubeSearchService { List allItems = new ArrayList<>(); for (String target : searchTargets) { - String order = StringUtils.hasText(condition.getKeyword()) ? "relevance" : "date"; + String order = StringUtils.hasText(condition.getOrder()) + ? condition.getOrder() + : (StringUtils.hasText(condition.getKeyword()) ? "relevance" : "date"); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(searchApiUrl) .queryParam("part", "snippet") diff --git a/src/main/java/com/hlab/yanalyst/web/WebController.java b/src/main/java/com/hlab/yanalyst/web/WebController.java index b3703c3..fa05177 100644 --- a/src/main/java/com/hlab/yanalyst/web/WebController.java +++ b/src/main/java/com/hlab/yanalyst/web/WebController.java @@ -52,6 +52,12 @@ public class WebController { return "discover"; } + @GetMapping("/recommend") + public String recommend(Model model) { + model.addAttribute("currentPage", "recommend"); + return "recommend"; + } + @GetMapping("/publish") public String publish(Model model) { model.addAttribute("currentPage", "publish"); diff --git a/src/main/java/com/hlab/yanalyst/web/dto/YoutubeSearchCondition.java b/src/main/java/com/hlab/yanalyst/web/dto/YoutubeSearchCondition.java index 8a36c2d..35987a5 100644 --- a/src/main/java/com/hlab/yanalyst/web/dto/YoutubeSearchCondition.java +++ b/src/main/java/com/hlab/yanalyst/web/dto/YoutubeSearchCondition.java @@ -11,4 +11,5 @@ public class YoutubeSearchCondition { private String format; // "SHORTS" or "LONG_FORM" private java.util.Map pageTokens; private List channelIds; // e.g. ["UC...", "UC..."] + private String order; // search.list order 강제(예: "viewCount"). 비우면 키워드 유무로 자동. } diff --git a/src/main/resources/templates/layout/sidebar.html b/src/main/resources/templates/layout/sidebar.html index 5572515..f32f3dc 100644 --- a/src/main/resources/templates/layout/sidebar.html +++ b/src/main/resources/templates/layout/sidebar.html @@ -27,6 +27,9 @@ 발굴 + + 추천 채널 + 채널 diff --git a/src/main/resources/templates/recommend.html b/src/main/resources/templates/recommend.html new file mode 100644 index 0000000..089ca87 --- /dev/null +++ b/src/main/resources/templates/recommend.html @@ -0,0 +1,68 @@ + + +h-lab - 추천 채널 + +
+ + + +
+ + + + +
+ +