feat: v3.0.0 - intelligent search, GitHub person/project mode, ELI5, 13+ sources

v3 rewrites the search engine from the ground up:

- Intelligent pre-research: resolves X handles, GitHub repos, subreddits,
  TikTok hashtags, and YouTube channels before searching
- GitHub person-mode: PR velocity, top repos by stars, release notes
- GitHub project-mode: live star counts, README, releases, top issues
- ELI5 mode: plain language synthesis, no jargon
- 13+ sources: Reddit, X, YouTube, TikTok, Instagram, HN, Polymarket,
  GitHub, Threads, Pinterest, Perplexity, Bluesky, Web
- Free Reddit comments via public JSON (no API key needed)
- Fun judge v2: humor scoring baked into narrative
- Cookie consent before browser scanning
- 10,000 free ScrapeCreators calls
- 1,012 tests

Thank you to the community contributors whose issues and PRs shaped v3:
@uppinote20 (#143), @zerone0x (#134, #136), @thinkun (#116),
@thomasmktong (#124), @fanispoulinakisai-boop (#100), @pejmanjohn (#78),
@zl190 (#115), @hnshah (#84, #85, #86)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-04-08 10:52:23 -07:00
parent 61904b31e3
commit 0a9ff16dfc
397 changed files with 21427 additions and 53106 deletions
+23 -12
View File
@@ -5,13 +5,24 @@ import re
import sys
from typing import Any, Dict, List, Optional
from . import http
from . import http, log
def _safe_text(val) -> str:
"""Extract text from string or localized object."""
if isinstance(val, str):
return val
if isinstance(val, dict):
return str(val.get("text", val.get("en", "")))
return str(val) if val is not None else ""
def _log(msg: str):
log.source_log("xAI", msg, tty_only=False)
def _log_error(msg: str):
"""Log error to stderr."""
sys.stderr.write(f"[X ERROR] {msg}\n")
sys.stderr.flush()
log.source_log("xAI ERROR", msg, tty_only=False)
# xAI uses responses endpoint with Agent Tools API
XAI_RESPONSES_URL = "https://api.x.ai/v1/responses"
@@ -173,7 +184,7 @@ def parse_x_response(response: Dict[str, Any]) -> List[Dict[str, Any]]:
data = json.loads(json_match.group())
items = data.get("items", [])
except json.JSONDecodeError:
pass
_log(f"Failed to parse xAI response JSON: {output_text[:200]}")
# Validate and clean items
clean_items = []
@@ -190,20 +201,20 @@ def parse_x_response(response: Dict[str, Any]) -> List[Dict[str, Any]]:
eng_raw = item.get("engagement")
if isinstance(eng_raw, dict):
engagement = {
"likes": int(eng_raw.get("likes", 0)) if eng_raw.get("likes") else None,
"reposts": int(eng_raw.get("reposts", 0)) if eng_raw.get("reposts") else None,
"replies": int(eng_raw.get("replies", 0)) if eng_raw.get("replies") else None,
"quotes": int(eng_raw.get("quotes", 0)) if eng_raw.get("quotes") else None,
"likes": int(eng_raw["likes"]) if eng_raw.get("likes") is not None else None,
"reposts": int(eng_raw["reposts"]) if eng_raw.get("reposts") is not None else None,
"replies": int(eng_raw["replies"]) if eng_raw.get("replies") is not None else None,
"quotes": int(eng_raw["quotes"]) if eng_raw.get("quotes") is not None else None,
}
clean_item = {
"id": f"X{i+1}",
"text": str(item.get("text", "")).strip()[:500], # Truncate long text
"text": _safe_text(item.get("text", "")).strip()[:500], # Truncate long text
"url": url,
"author_handle": str(item.get("author_handle", "")).strip().lstrip("@"),
"author_handle": _safe_text(item.get("author_handle", "")).strip().lstrip("@"),
"date": item.get("date"),
"engagement": engagement,
"why_relevant": str(item.get("why_relevant", "")).strip(),
"why_relevant": _safe_text(item.get("why_relevant", "")).strip(),
"relevance": min(1.0, max(0.0, float(item.get("relevance", 0.5)))),
}