Skip to content

fix(xiaohongshu): use /search_result/<id> for bare note IDs#774

Merged
jackwener merged 1 commit intojackwener:mainfrom
kingOfSoySauce:fix/xiaohongshu-note-bare-id
Apr 4, 2026
Merged

fix(xiaohongshu): use /search_result/<id> for bare note IDs#774
jackwener merged 1 commit intojackwener:mainfrom
kingOfSoySauce:fix/xiaohongshu-note-bare-id

Conversation

@kingOfSoySauce
Copy link
Copy Markdown
Contributor

Problem

opencli xiaohongshu note <bare-id> returns exit code 66 (empty result) because buildNoteUrl constructs /explore/<id> URLs. XHS now blocks this path without a valid xsec_token, rendering an empty shell page.

Fix

Use /search_result/<id> instead of /explore/<id> for bare note IDs. This path works without xsec_token when the user is logged in via cookies (which is always the case with opencli browser-based commands).

Changes

  • note-helpers.ts: buildNoteUrl now returns /search_result/<id> for bare IDs
  • note.ts: Remove isBareNoteId branching and simplify empty-shell error message

Testing

Before (bare ID fails):

$ opencli xiaohongshu note 69ab16f4000000002203b15a
📭 xiaohongshu/note returned no data
(Command exited with code 66)

After (bare ID works):

$ opencli xiaohongshu note 69ab16f4000000002203b15a -f json
[
  {"field": "title", "value": "元辅怎么样打到顶级呢"},
  {"field": "author", "value": "程不识"},
  {"field": "content", "value": "..."},
  ...]

Full URLs with xsec_token continue to work as before.

XHS blocks /explore/<id> without a valid xsec_token, causing code 66
(empty result) when passing bare note IDs. The /search_result/<id> path
works without xsec_token when the user is logged in via cookies.

Changes:
- note-helpers.ts: buildNoteUrl now uses /search_result/<id> for bare IDs
- note.ts: remove isBareNoteId branching and simplify empty shell error
@jackwener jackwener force-pushed the fix/xiaohongshu-note-bare-id branch from 47d66c0 to 3614f26 Compare April 4, 2026 19:13
@jackwener jackwener merged commit cfb915b into jackwener:main Apr 4, 2026
jackwener added a commit that referenced this pull request Apr 4, 2026
Tests now expect /search_result/<id> for bare note IDs (matching
the note-helpers.ts change from PR #774) and updated empty-shell
hint assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jackwener added a commit that referenced this pull request Apr 4, 2026
* refactor: simplify core modules — remove root shims, consolidate error classification, streamline cascade/interceptor, clean up synthesize

1. Remove root-level shim files (errors.ts, logger.ts, registry.ts, types.ts, utils.ts, launcher.ts) — update all ~840 adapter imports to reference src/ directly
2. Consolidate interceptor: reuse shared DISGUISE_FN in tap interceptor instead of reimplementing
3. Unify error classification: single ClassifiedError type with icon/exitCode/hint lookup table, eliminating duplicated pattern matching between resolveExitCode and renderError
4. Simplify cascade probe: replace repetitive switch cases with PROBE_OPTIONS lookup map
12. Clean up synthesize.ts: remove deprecated snake_case field aliases (recommended_args, recommended_columns, recommendedColumnsLegacy) and unnecessary constant aliases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update import paths in contributor docs and skill templates

Update all documentation and skill files to reference src/ directly,
matching the shim removal in the previous commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update new Gemini adapter imports to use src/ paths

Fix imports in newly added deep-research adapter files that were
still referencing the deleted root shim files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update xiaohongshu tests for /search_result/ URL change

Tests now expect /search_result/<id> for bare note IDs (matching
the note-helpers.ts change from PR #774) and updated empty-shell
hint assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update LessWrong and hupu adapter imports to use src/ paths

Fix imports in newly merged LessWrong and hupu/mentions adapter
files that were still referencing the deleted root shim files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(xueqiu): mock logger via src path

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants