Skip to content

feat(qimao): add qimao site adapter#1424

Open
skinapi2025 wants to merge 1 commit into
jackwener:mainfrom
skinapi2025:main
Open

feat(qimao): add qimao site adapter#1424
skinapi2025 wants to merge 1 commit into
jackwener:mainfrom
skinapi2025:main

Conversation

@skinapi2025
Copy link
Copy Markdown

Summary

This PR adds a new qimao site adapter for 七猫中文网 and wires it into OpenCLI's built-in adapter registry.

New Qimao commands included in this PR:

  • opencli qimao search
  • opencli qimao catalog
  • opencli qimao book
  • opencli qimao read
  • opencli qimao browse
  • opencli qimao browse-options
  • opencli qimao rank
  • opencli qimao rank-options

What’s Added

Core book flow

Implemented the basic read pipeline for Qimao books:

  • search: search books by title, author, or character
  • catalog: list chapters for a book
  • book: fetch book detail data
  • read: read chapter content by chapter id or chapter index

Category browsing

Added support for Qimao classification pages:

  • browse: list books from category pages with filters
  • browse-options: enumerate available filter values for programmatic use

Supported browse dimensions:

  • channel
  • category / subcategory
  • word count range
  • update time
  • completion status
  • sort order

Ranking lists

Added support for Qimao ranking pages:

  • rank: fetch ranking list results
  • rank-options: enumerate ranking dimensions for programmatic use

Supported rank dimensions:

  • channel: boy / girl
  • type: hot / new / over / collect / update
  • period: date / month

Implementation Notes

Data sources

The adapter uses a mix of public endpoints and browser-backed extraction depending on the page type:

  • Search and catalog use Qimao public APIs
  • Browse uses Qimao classify APIs
  • Book and read use browser-backed extraction from page state / rendered content
  • Rank uses browser-backed extraction from Qimao ranking pages

Shared helpers

Added shared utilities for:

  • Qimao URL construction
  • ID parsing
  • HTML/plain-text normalization
  • filter metadata handling
  • ranking metadata handling

Text cleanup

Included normalization improvements for Qimao text fields:

  • read.content removes empty lines
  • search.intro removes empty lines
  • read.book_title includes fallback extraction when the chapter page does not expose a stable title directly

Tests

Added adapter tests for Qimao coverage in clis/qimao/qimao.test.js.

Covered areas:

  • utils
  • search
  • catalog
  • book
  • read
  • browse
  • browse-options
  • rank
  • rank-options

Validation performed:

npx vitest run --project adapter clis/qimao/qimao.test.js
npm test

Registry / Discovery

Updated cli-manifest.json so the new qimao commands are discoverable by OpenCLI.

Notes

  • This PR only contains Qimao-related adapter code and manifest updates.
  • README changes were intentionally excluded from the submitted commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant