mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-11 12:17:45 +02:00
[eric] fix WebSearch DDG parser, diagnose duplicate text + browser issues
WebSearch fix: - DuckDuckGo changed HTML attribute order (class before href) - Added fallback regex to handle both orderings - WebSearch now returns results correctly Diagnosed issues (not yet fixed): - Duplicate text: caused by 2 WebSocket connections to same session (frontend React component mounts twice). Pre-existing Haik code issue. - Browser agent "not found": browser cards require Electron webview, doesn't work in regular browser (localhost:3000). Expected behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
36d79fd1d3
commit
baedeee47d
@@ -108,12 +108,19 @@ class WebSearchTool(BaseTool):
|
||||
if len(entries) >= num_results:
|
||||
break
|
||||
|
||||
# Title + URL
|
||||
# Title + URL — handle both class-before-href and href-before-class
|
||||
link_match = re.search(
|
||||
r'<a[^>]*class="[^"]*result__a[^"]*"[^>]*href="([^"]*)"[^>]*>(.*?)</a>',
|
||||
block,
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
if not link_match:
|
||||
# Try reversed attribute order
|
||||
link_match = re.search(
|
||||
r'<a[^>]*href="([^"]*)"[^>]*class="[^"]*result__a[^"]*"[^>]*>(.*?)</a>',
|
||||
block,
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
if not link_match:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user