fix: 2 real-usage bugs found in end-to-end testing
Bug 1: search-github/search-twitter silently returned empty Root cause: result printing code was inside except block (never reached on success) Fix: moved result display code outside try/except Bug 2: Bilibili returned empty content when server IP is blocked Root cause: API returns code -404 but code treated it as success with empty data Fix: check API response code, show friendly message with proxy setup hint Also: GitHub search results now correctly show stars/forks/language from extra dict All found through real-usage E2E testing (not just install/config testing).
This commit is contained in:
@@ -47,7 +47,29 @@ class BilibiliChannel(Channel):
|
||||
timeout=15,
|
||||
)
|
||||
resp.raise_for_status()
|
||||
data = resp.json().get("data", {})
|
||||
api_data = resp.json()
|
||||
|
||||
# Check for API errors (IP blocked, video not found, etc.)
|
||||
if api_data.get("code") != 0:
|
||||
msg = api_data.get("message", "Unknown error")
|
||||
# Bilibili returns -404 when server IP is blocked
|
||||
if api_data.get("code") in (-404, -403, -412):
|
||||
return ReadResult(
|
||||
title=f"Bilibili: {bv_id}",
|
||||
content=f"⚠️ Bilibili blocked this request ({msg}). "
|
||||
f"This usually means the server IP is blocked. "
|
||||
f"Try: agent-eyes configure proxy http://user:pass@ip:port",
|
||||
url=url,
|
||||
platform="bilibili",
|
||||
)
|
||||
return ReadResult(
|
||||
title=f"Bilibili: {bv_id}",
|
||||
content=f"Bilibili API error: {msg} (code: {api_data.get('code')})",
|
||||
url=url,
|
||||
platform="bilibili",
|
||||
)
|
||||
|
||||
data = api_data.get("data", {})
|
||||
|
||||
title = data.get("title", "")
|
||||
desc = data.get("desc", "")
|
||||
|
||||
Reference in New Issue
Block a user