fix: 4 bugs found in full E2E usage testing
Bug 1: Reddit 403 due to short User-Agent in proxy test
Root cause: configure proxy test used 'Mozilla/5.0' (too short, Reddit rejects)
Fix: use full UA string matching the channel implementation
Bug 2: Reddit URL parsing broke on trailing slashes
Root cause: url.rstrip('/') + '.json' mangled URLs with query params
Fix: properly parse URL, clean path, reconstruct json URL
Bug 3: Reddit 403 without proxy showed raw HTTP error
Root cause: no error handling for 403/429 responses
Fix: friendly message suggesting proxy setup + Exa search alternative
Bug 4: XiaoHongShu without cookie showed Jina Reader 451 error
Root cause: fallback to Jina Reader which can't access XHS (legal block)
Fix: show clear message about needing cookies with setup instructions
Bug 5: Empty search query caused raw 422 API error
Root cause: no input validation before API call
Fix: check for empty query, show friendly message
All 36 unit tests passing.
This commit is contained in:
@@ -27,9 +27,14 @@ class XiaoHongShuChannel(Channel):
|
||||
cookie = config.get("xhs_cookie") if config else None
|
||||
|
||||
if not cookie:
|
||||
# Fallback to Jina Reader (works for some public notes)
|
||||
from agent_eyes.channels.web import WebChannel
|
||||
return await WebChannel().read(url, config)
|
||||
return ReadResult(
|
||||
title="XiaoHongShu",
|
||||
content="⚠️ XiaoHongShu requires cookies to access.\n"
|
||||
"Set up: agent-eyes configure xhs-cookie \"YOUR_COOKIE_STRING\"\n"
|
||||
"How to get it: install Cookie-Editor extension → go to xiaohongshu.com → Export → Header String",
|
||||
url=url,
|
||||
platform="xiaohongshu",
|
||||
)
|
||||
|
||||
# Extract note ID from URL
|
||||
note_id = self._extract_note_id(url)
|
||||
|
||||
Reference in New Issue
Block a user