Skip to content

refactor(zhihu): simplify question evaluate to follow pixivFetch pattern#754

Merged
jackwener merged 1 commit intomainfrom
refactor/zhihu-question-simplify
Apr 4, 2026
Merged

refactor(zhihu): simplify question evaluate to follow pixivFetch pattern#754
jackwener merged 1 commit intomainfrom
refactor/zhihu-question-simplify

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Move HTML stripping and answer data mapping from browser-side evaluate to Node-side, keeping evaluate minimal (4 lines: fetch + status check)
  • Adopt __httpError sentinel convention consistent with pixivFetch (src/clis/pixiv/utils.ts)
  • Add null response handling for cases where evaluate returns nothing (e.g., browser-side exception)

Why

PR #732 fixed the runtime issue correctly but left 10 lines of logic inside the evaluate string (strip function, try/catch, data mapping). The established pattern in this codebase (see pixivFetch) keeps evaluate minimal and does all processing in Node where it's more readable, testable, and debuggable.

Test plan

  • All 5 zhihu question tests pass
  • Added new test for null evaluate response

Move data processing (HTML stripping, answer mapping) from browser-side
evaluate to Node-side, keeping the evaluate minimal: just fetch + status
check. Uses __httpError sentinel consistent with pixivFetch convention.
@jackwener jackwener merged commit 052bf8b into main Apr 4, 2026
11 checks passed
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