Skip to content

feat(client): 实现 JmHtmlClient#getPromote、 JmHtmlClient#getPromoteList 方法 - #11

Merged
JUKOMU merged 1 commit into
masterfrom
dev
Jul 17, 2026
Merged

feat(client): 实现 JmHtmlClient#getPromote、 JmHtmlClient#getPromoteList 方法#11
JUKOMU merged 1 commit into
masterfrom
dev

Conversation

@JUKOMU

@JUKOMU JUKOMU commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • 新功能
    • 支持加载首页推荐内容,展示推荐分类、专辑标题、封面及作者信息。
    • 支持访问推荐分类的更多内容,并按页查看结果。
  • 问题修复
    • 改进搜索结果总数的识别,兼容更多页面格式。
    • 优化部分专辑信息缺少作者时的页面处理,避免解析异常。

@JUKOMU JUKOMU added the enhancement New feature or request label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

推广 HTML 流程

Layer / File(s) Summary
推广与搜索结果解析
jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/HtmlParser.java
新增推广分类解析方法和搜索结果总数备用正则;无作者卡片返回空作者集合。
推广客户端接口接入
jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmHtmlClient.java
推广接口执行 HTML GET 请求,校验过滤参数并解析推广分类或分页搜索结果。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant JmHtmlClient
  participant HtmlServer
  participant HtmlParser
  JmHtmlClient->>HtmlServer: GET 推广页面或分类列表
  HtmlServer-->>JmHtmlClient: 返回 HTML
  JmHtmlClient->>HtmlParser: 解析推广分类或搜索页
  HtmlParser-->>JmHtmlClient: 返回结构化结果
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次提交的主要改动:实现了 JmHtmlClient 的 getPromote 和 getPromoteList 方法。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/HtmlParser.java (1)

440-483: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

parsePromoteJmPromoteCategorytype 字段为空字符串。

parsePromote 构造 JmPromoteCategory 时将 idslugtype 均设为空字符串。HTML 客户端的 getPromoteList 仅依赖 filterVal 构建 URL,不受影响。但 JmApiClient.getPromoteList 通过 category.getType() 进行分支选择——如果调用方混用两个客户端返回的 JmPromoteCategory 对象,空 type 会导致 API 客户端逻辑出错。

建议在方法注释中明确说明 HTML 解析的 JmPromoteCategorytitlefilterValcontent 有效,其余字段为空。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/HtmlParser.java`
around lines 440 - 483, Update the documentation for parsePromote to state that
HTML-parsed JmPromoteCategory instances only provide title, filterVal, and
content, while id, slug, and type remain empty and must not be used for
JmApiClient.getPromoteList branching.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmHtmlClient.java`:
- Around line 519-521: 在 JmHtmlClient 中处理 HttpUrl.parse 返回值:在使用
parsed.pathSize() 前增加 null 检查,解析失败时安全退出当前 URL 处理流程,避免继续访问 parsed。保持正常相对路径解析及
newHttpUrlBuilder() 的现有行为不变。

---

Nitpick comments:
In
`@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/HtmlParser.java`:
- Around line 440-483: Update the documentation for parsePromote to state that
HTML-parsed JmPromoteCategory instances only provide title, filterVal, and
content, while id, slug, and type remain empty and must not be used for
JmApiClient.getPromoteList branching.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 192ba8e3-63b3-4368-bcf8-a590980d4ecb

📥 Commits

Reviewing files that changed from the base of the PR and between 1a329f3 and 5eabf3c.

📒 Files selected for processing (2)
  • jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmHtmlClient.java
  • jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/HtmlParser.java

@JUKOMU
JUKOMU merged commit 6423b16 into master Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant