argo-search 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +8 -6
- package/README.es.md +56 -824
- package/README.ja.md +55 -825
- package/README.ko.md +55 -823
- package/README.md +128 -868
- package/README.zh.md +206 -0
- package/SKILL.md +17 -18
- package/assets/readme/counts.json +1 -1
- package/assets/readme/hero.svg +23 -23
- package/backends/concept_vectors.bin +0 -0
- package/backends/domain_profiles.json +66 -0
- package/backends/engine_concept_vectors.json +1525 -1525
- package/backends/engine_registry.yaml +193 -46
- package/backends/quota_profiles.json +110 -0
- package/bin/argo +30 -17
- package/config.yaml +196 -36
- package/docs/ADDING_NEW_ENGINE.md +10 -0
- package/docs/ARGO_INTRO.md +1 -1
- package/docs/CHANGELOG.md +45 -0
- package/docs/ENGINE_CATALOG.md +128 -112
- package/docs/MCP_SETUP.md +2 -2
- package/docs/RELEASE_NOTES_v2.14.0.md +12 -1
- package/docs/RELEASE_NOTES_v2.14.1.md +80 -0
- package/docs/RELEASE_NOTES_v2.15.0.md +50 -0
- package/docs/RELEASING.md +53 -1
- package/engines/specs/ai_labs.yaml +89 -0
- package/engines/specs/artic.yaml +11 -1
- package/engines/specs/bilibili_hot.yaml +11 -1
- package/engines/specs/brave.yaml +3 -3
- package/engines/specs/cisa_alerts.yaml +40 -0
- package/engines/specs/cleveland.yaml +15 -1
- package/engines/specs/clinicaltrials.yaml +16 -1
- package/engines/specs/cn_ai_news.yaml +10 -8
- package/engines/specs/cnii.yaml +15 -4
- package/engines/specs/deezer.yaml +12 -1
- package/engines/specs/digup.yaml +11 -6
- package/engines/specs/doaj.yaml +14 -1
- package/engines/specs/douyin_hot.yaml +11 -1
- package/engines/specs/dw_news.yaml +4 -2
- package/engines/specs/endoflife.yaml +16 -1
- package/engines/specs/eng_blogs.yaml +63 -0
- package/engines/specs/eu_opendata.yaml +11 -1
- package/engines/specs/europeana.yaml +22 -5
- package/engines/specs/feed.yaml +62 -0
- package/engines/specs/felo.yaml +3 -3
- package/engines/specs/figshare.yaml +12 -1
- package/engines/specs/firecrawl.yaml +3 -0
- package/engines/specs/fourget.yaml +5 -2
- package/engines/specs/france24.yaml +6 -4
- package/engines/specs/fxtwitter.yaml +29 -6
- package/engines/specs/grepapp_mcp.yaml +62 -0
- package/engines/specs/guardian_rss.yaml +6 -4
- package/engines/specs/hackernews.yaml +17 -2
- package/engines/specs/hal.yaml +19 -1
- package/engines/specs/hf_datasets.yaml +59 -0
- package/engines/specs/hf_papers.yaml +17 -1
- package/engines/specs/itotii.yaml +13 -1
- package/engines/specs/jikan.yaml +12 -10
- package/engines/specs/kaggle.yaml +5 -3
- package/engines/specs/lobsters.yaml +41 -0
- package/engines/specs/local_seek.yaml +6 -0
- package/engines/specs/maven.yaml +61 -0
- package/engines/specs/nasa_cmr.yaml +12 -1
- package/engines/specs/nuget.yaml +57 -0
- package/engines/specs/open_meteo.yaml +1 -1
- package/engines/specs/redskill.yaml +2 -0
- package/engines/specs/searxng.yaml +4 -2
- package/engines/specs/sec_edgar.yaml +8 -3
- package/engines/specs/tatoeba.yaml +14 -1
- package/engines/specs/tinyfish.yaml +2 -0
- package/engines/specs/tinyfish_news.yaml +2 -0
- package/engines/specs/tinyfish_paper.yaml +2 -0
- package/engines/specs/toutiao_hot.yaml +11 -1
- package/engines/specs/train.yaml +3 -0
- package/engines/specs/tvmaze.yaml +5 -1
- package/engines/specs/twitter.yaml +4 -0
- package/engines/specs/unpaywall.yaml +6 -0
- package/engines/specs/usda.yaml +14 -1
- package/engines/specs/vam.yaml +17 -3
- package/engines/specs/weibo_hot.yaml +11 -1
- package/engines/specs/wolframalpha.yaml +3 -3
- package/engines/specs/xiaohongshu.yaml +2 -0
- package/engines/specs/zhihu.yaml +3 -18
- package/engines/specs/zhihu_kb.yaml +18 -0
- package/engines/specs/zhihu_questions.yaml +19 -0
- package/package.json +4 -2
- package/packages/dsh-plugin/README.md +9 -14
- package/packages/dsh-plugin/dsh/client.js +467 -1024
- package/packages/dsh-plugin/dsh/diagnostics.js +71 -20
- package/packages/dsh-plugin/dsh/native-tools.mjs +61 -113
- package/packages/dsh-plugin/dsh/runner.js +2 -0
- package/packages/dsh-plugin/dsh/wide-research.js +1 -1
- package/packages/dsh-plugin/package.json +8 -3
- package/packages/dsh-plugin/scripts/sync-local.mjs +87 -0
- package/packages/dsh-plugin/scripts/sync-local.sh +13 -1
- package/packages/dsh-plugin/test/diagnostics.test.js +38 -1
- package/packages/dsh-plugin/test/size-gate.test.js +2 -9
- package/scripts/adaptive.py +7 -1
- package/scripts/archive_run.py +112 -53
- package/scripts/argo_paths.py +40 -3
- package/scripts/badcase_ledger.py +153 -10
- package/scripts/build_concept_table.py +112 -55
- package/scripts/build_release_assets.sh +43 -15
- package/scripts/cache.py +5 -1
- package/scripts/caliber_isolation.py +60 -23
- package/scripts/circuit_breaker.py +56 -8
- package/scripts/cli_io.py +20 -2
- package/scripts/config_cache.py +31 -0
- package/scripts/daemon.py +146 -51
- package/scripts/dormant_ledger.py +239 -0
- package/scripts/engine_dispatch.py +3 -3
- package/scripts/engine_env.py +182 -1
- package/scripts/engine_families.py +50 -7
- package/scripts/engine_states.py +9 -51
- package/scripts/engine_validate.py +150 -6
- package/scripts/engines.py +15 -67
- package/scripts/engines_base.py +68 -124
- package/scripts/engines_builders.py +0 -51
- package/scripts/engines_builders_batch10.py +346 -100
- package/scripts/engines_builders_batch11.py +2 -75
- package/scripts/engines_builders_batch9.py +15 -228
- package/scripts/engines_builders_cn.py +0 -194
- package/scripts/engines_builders_feeds.py +203 -35
- package/scripts/engines_builders_intl.py +15 -443
- package/scripts/engines_builders_pixiv.py +2 -16
- package/scripts/engines_builders_science.py +0 -85
- package/scripts/engines_builders_search.py +7 -14
- package/scripts/engines_builders_tech.py +5 -112
- package/scripts/engines_builders_weather.py +236 -0
- package/scripts/engines_fields.py +91 -0
- package/scripts/engines_http.py +135 -0
- package/scripts/engines_mcp.py +383 -0
- package/scripts/engines_parsers.py +196 -27
- package/scripts/engines_schema_drift.py +260 -0
- package/scripts/evidence.py +13 -0
- package/scripts/evidence_loop.py +93 -5
- package/scripts/fetch_jsrun.py +15 -11
- package/scripts/fetch_v3.py +28 -28
- package/scripts/fulltext_store.py +42 -1
- package/scripts/fxtwitter_api.py +8 -7
- package/scripts/gen_engine_catalog.py +4 -4
- package/scripts/gen_native_tools.py +2 -1
- package/scripts/general_pool.py +15 -4
- package/scripts/health_check.py +1 -1
- package/scripts/link_source.py +65 -24
- package/scripts/local_intent.py +51 -15
- package/scripts/local_seek.py +37 -4
- package/scripts/local_seek_adapter.py +57 -17
- package/scripts/mcp_handlers.py +173 -99
- package/scripts/mcp_handlers_surface.py +6 -18
- package/scripts/mcp_server.py +1 -1
- package/scripts/mcp_tools.py +143 -61
- package/scripts/mcp_transport.py +42 -10
- package/scripts/min_version_scan.py +7 -3
- package/scripts/network_aware.py +7 -13
- package/scripts/pre-commit +57 -31
- package/scripts/query_understanding.py +30 -6
- package/scripts/quota.py +6 -1
- package/scripts/rank_signals.py +9 -0
- package/scripts/recompute.py +15 -5
- package/scripts/recovery.py +21 -15
- package/scripts/release.py +29 -32
- package/scripts/release_check.py +6 -26
- package/scripts/replay_eval.py +2 -2
- package/scripts/research_cli.py +40 -0
- package/scripts/research_notes.py +368 -0
- package/scripts/route.py +32 -70
- package/scripts/route_audit.py +259 -0
- package/scripts/route_combo.py +10 -4
- package/scripts/route_domains.py +150 -23
- package/scripts/route_lang.py +20 -7
- package/scripts/route_log.py +26 -9
- package/scripts/route_policy.py +91 -7
- package/scripts/route_telemetry_export.py +199 -0
- package/scripts/rrf_classic.py +5 -22
- package/scripts/search.py +2 -1
- package/scripts/search_attribution.py +33 -10
- package/scripts/search_cli.py +44 -7
- package/scripts/search_entry.py +5 -1
- package/scripts/search_output.py +5 -4
- package/scripts/search_pipeline.py +12 -0
- package/scripts/search_rank.py +21 -11
- package/scripts/secret_guard.py +106 -0
- package/scripts/semantic_evidence.py +539 -117
- package/scripts/settings_page.py +83 -11
- package/scripts/social_engines/xiaohongshu_engine.py +2 -1
- package/scripts/social_engines/zhihu_engine.py +251 -43
- package/scripts/sogou_weixin_browser.py +5 -6
- package/scripts/source_audit.py +77 -0
- package/scripts/source_ledger.py +2 -15
- package/scripts/source_selection.py +45 -20
- package/scripts/straggler_policy.py +1 -2
- package/scripts/sync_backends.py +24 -0
- package/scripts/tfidf_router.py +23 -11
- package/scripts/time_utils.py +54 -1
- package/scripts/train.py +68 -2
- package/scripts/usage_log.py +26 -1
- package/sub-skills/argo-wide-research/SKILL.md +68 -0
- package/sub-skills/ego-search/SKILL.md +1 -1
- package/sub-skills/local-seek/scripts/seek_fts.py +67 -4
- package/README.en.md +0 -826
- package/scripts/caliber_dedupe.py +0 -66
- package/scripts/engines_builders_batch16.py +0 -186
- package/scripts/health_probe.py +0 -253
- package/scripts/image_vision/vision_probe +0 -0
- package/scripts/social_engines/twitter_engine.py +0 -514
- package/scripts/sync_installs.py +0 -29
|
@@ -48,7 +48,13 @@ from engines_base import (
|
|
|
48
48
|
http_open,
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
from engines_http import (
|
|
52
|
+
http_json as _shared_http_json,
|
|
53
|
+
http_text as _shared_http_text,
|
|
54
|
+
lazy_logger,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
logger = lazy_logger()
|
|
52
58
|
|
|
53
59
|
_UA = "argo-search/2.8 (+batch9)"
|
|
54
60
|
|
|
@@ -74,33 +80,18 @@ def _terms(q: str) -> list[str]:
|
|
|
74
80
|
|
|
75
81
|
|
|
76
82
|
|
|
77
|
-
def _read(resp, engine: str = "") -> bytes:
|
|
78
|
-
"""读取响应体,容忍 IncompleteRead。
|
|
79
|
-
|
|
80
|
-
大体积响应(e-Gov 法令列表实测 2.7MB)在 http.client 上偶发
|
|
81
|
-
`IncompleteRead` —— 此时已读到的部分数据仍然可用(我们先拿头部/整体结构),
|
|
82
|
-
所以接受 partial 而不是直接失败。
|
|
83
|
-
"""
|
|
84
|
-
try:
|
|
85
|
-
return resp.read()
|
|
86
|
-
except Exception as e: # http.client.IncompleteRead 等
|
|
87
|
-
partial = getattr(e, "partial", None)
|
|
88
|
-
if partial:
|
|
89
|
-
logger.warning(f"{engine} 响应不完整,使用已读部分 {len(partial)}B")
|
|
90
|
-
return partial
|
|
91
|
-
raise
|
|
92
|
-
|
|
93
|
-
|
|
94
83
|
def _json(url: str, to: float, engine: str = "") -> Any:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
return _shared_http_json(
|
|
85
|
+
url, to, engine=engine, headers={"Accept": "application/json"},
|
|
86
|
+
ua=_UA, accept_partial=True, opener=http_open,
|
|
87
|
+
)
|
|
98
88
|
|
|
99
89
|
|
|
100
90
|
def _text(url: str, to: float, engine: str = "", accept: str = "*/*") -> str:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
return _shared_http_text(
|
|
92
|
+
url, to, engine=engine, headers={"Accept": accept},
|
|
93
|
+
ua=_UA, accept_partial=True, opener=http_open,
|
|
94
|
+
)
|
|
104
95
|
|
|
105
96
|
|
|
106
97
|
# ── WHO DON 疫情暴发通报 ──────────────────────────────────────────────────────
|
|
@@ -592,212 +583,8 @@ def _build_openligadb_engine(spec: dict[str, Any]) -> Any:
|
|
|
592
583
|
return _engine
|
|
593
584
|
|
|
594
585
|
|
|
595
|
-
# ── 博物馆:AIC + Cleveland(补 art_museum 域)────────────────────────────────
|
|
596
|
-
|
|
597
|
-
def _build_artic_engine(spec: dict[str, Any]) -> Any:
|
|
598
|
-
"""Art Institute of Chicago 馆藏(免认证,含 IIIF 图像)。"""
|
|
599
|
-
timeout = spec.get("timeout", 20)
|
|
600
|
-
|
|
601
|
-
@safe_search
|
|
602
|
-
def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
603
|
-
to = _timeout or timeout
|
|
604
|
-
q = (query or "").strip()
|
|
605
|
-
if not q:
|
|
606
|
-
return []
|
|
607
|
-
url = ("https://api.artic.edu/api/v1/artworks/search?"
|
|
608
|
-
f"q={urllib.parse.quote(q)}&limit={n}"
|
|
609
|
-
"&fields=id,title,artist_display,date_display,image_id")
|
|
610
|
-
try:
|
|
611
|
-
data = _json(url, to, spec.get("_name", ""))
|
|
612
|
-
except Exception as e:
|
|
613
|
-
logger.warning(f"AIC 失败: {e}")
|
|
614
|
-
return []
|
|
615
|
-
# IIIF 基址取响应自带的 config.iiif_url,不硬编码——上游换域时硬编码会
|
|
616
|
-
# 静默失效。该图床要求带 AIC-User-Agent 头才放行直连(否则 403 HEAD)。
|
|
617
|
-
iiif = str(((data.get("config") or {}).get("iiif_url")) or "").rstrip("/")
|
|
618
|
-
results = []
|
|
619
|
-
for _rk, it in enumerate((data.get("data") or [])[:n]):
|
|
620
|
-
if not isinstance(it, dict):
|
|
621
|
-
continue
|
|
622
|
-
title = (it.get("title") or "").strip()
|
|
623
|
-
if not title:
|
|
624
|
-
continue
|
|
625
|
-
_row = {
|
|
626
|
-
"title": title[:200],
|
|
627
|
-
"url": f"https://www.artic.edu/artworks/{it.get('id','')}",
|
|
628
|
-
"snippet": (f"{it.get('artist_display','')} · {it.get('date_display','')}"
|
|
629
|
-
"(芝加哥艺术博物馆)")[:300],
|
|
630
|
-
"source": "artic",
|
|
631
|
-
"score": rank_score(0.85, _rk),
|
|
632
|
-
}
|
|
633
|
-
# 图片字段:请求里本就取了 image_id(此前取到即丢),这里按 AIC
|
|
634
|
-
# 官方 IIIF 模板拼出可直接打开的图;无 image_id 的藏品不加字段。
|
|
635
|
-
_iid = str(it.get("image_id") or "").strip()
|
|
636
|
-
if _iid and iiif:
|
|
637
|
-
_row["image_url"] = f"{iiif}/{_iid}/full/843,/0/default.jpg"
|
|
638
|
-
_row["image_license"] = "AIC 公开接口(权利状态见作品页)"
|
|
639
|
-
results.append(_row)
|
|
640
|
-
return results
|
|
641
|
-
return _engine
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
def _build_cleveland_engine(spec: dict[str, Any]) -> Any:
|
|
645
|
-
"""克利夫兰艺术博物馆(CC0 开放图像)。"""
|
|
646
|
-
timeout = spec.get("timeout", 20)
|
|
647
|
-
|
|
648
|
-
@safe_search
|
|
649
|
-
def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
650
|
-
to = _timeout or timeout
|
|
651
|
-
q = (query or "").strip()
|
|
652
|
-
if not q:
|
|
653
|
-
return []
|
|
654
|
-
url = ("https://openaccess-api.clevelandart.org/api/artworks/?"
|
|
655
|
-
f"q={urllib.parse.quote(q)}&limit={n}&has_image=1")
|
|
656
|
-
try:
|
|
657
|
-
data = _json(url, to, spec.get("_name", ""))
|
|
658
|
-
except Exception as e:
|
|
659
|
-
logger.warning(f"Cleveland 失败: {e}")
|
|
660
|
-
return []
|
|
661
|
-
results = []
|
|
662
|
-
for _rk, it in enumerate((data.get("data") or [])[:n]):
|
|
663
|
-
if not isinstance(it, dict):
|
|
664
|
-
continue
|
|
665
|
-
title = (it.get("title") or "").strip()
|
|
666
|
-
if not title:
|
|
667
|
-
continue
|
|
668
|
-
_lic = str(it.get("share_license_status") or "").strip()
|
|
669
|
-
_row = {
|
|
670
|
-
"title": title[:200],
|
|
671
|
-
"url": it.get("url") or "https://www.clevelandart.org/",
|
|
672
|
-
"snippet": (f"{it.get('tombstone','')} · 授权 {_lic}"
|
|
673
|
-
"(克利夫兰艺术博物馆)")[:300],
|
|
674
|
-
"source": "cleveland",
|
|
675
|
-
"score": rank_score(0.85, _rk),
|
|
676
|
-
}
|
|
677
|
-
# 图片字段:请求已带 has_image=1,这里把 images.web.url 一并带上
|
|
678
|
-
# (web 尺寸适合直接展示,full/print 留给需要原图的场景)。
|
|
679
|
-
_img = str((((it.get("images") or {}).get("web") or {}).get("url")) or "").strip()
|
|
680
|
-
if _img:
|
|
681
|
-
_row["image_url"] = _img
|
|
682
|
-
if _lic:
|
|
683
|
-
_row["image_license"] = _lic
|
|
684
|
-
results.append(_row)
|
|
685
|
-
return results
|
|
686
|
-
return _engine
|
|
687
|
-
|
|
688
|
-
|
|
689
586
|
# ── 影视/动漫/音乐 ────────────────────────────────────────────────────────────
|
|
690
587
|
|
|
691
|
-
def _build_tvmaze_engine(spec: dict[str, Any]) -> Any:
|
|
692
|
-
"""TVMaze 电视剧元数据(免认证,补 film_search 的剧集维度)。"""
|
|
693
|
-
timeout = spec.get("timeout", 15)
|
|
694
|
-
|
|
695
|
-
@safe_search
|
|
696
|
-
def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
697
|
-
to = _timeout or timeout
|
|
698
|
-
q = (query or "").strip()
|
|
699
|
-
if not q:
|
|
700
|
-
return []
|
|
701
|
-
url = f"https://api.tvmaze.com/search/shows?q={urllib.parse.quote(q)}"
|
|
702
|
-
try:
|
|
703
|
-
data = _json(url, to, spec.get("_name", ""))
|
|
704
|
-
except Exception as e:
|
|
705
|
-
logger.warning(f"TVMaze 失败: {e}")
|
|
706
|
-
return []
|
|
707
|
-
results = []
|
|
708
|
-
for _rk, row in enumerate((data or [])[:n]):
|
|
709
|
-
if not isinstance(row, dict):
|
|
710
|
-
continue
|
|
711
|
-
s = row.get("show") or {}
|
|
712
|
-
name = (s.get("name") or "").strip()
|
|
713
|
-
if not name:
|
|
714
|
-
continue
|
|
715
|
-
genres = ", ".join(s.get("genres") or [])
|
|
716
|
-
results.append({
|
|
717
|
-
"title": f"{name}({s.get('premiered','')[:4]})"[:200],
|
|
718
|
-
"url": s.get("url") or "",
|
|
719
|
-
"snippet": (f"{s.get('language','')} · {genres} · "
|
|
720
|
-
f"评分 {((s.get('rating') or {}).get('average')) or '-'}"
|
|
721
|
-
"(TVMaze)")[:300],
|
|
722
|
-
"source": "tvmaze",
|
|
723
|
-
"score": rank_score(0.8, _rk),
|
|
724
|
-
"published_at": s.get("premiered") or "",
|
|
725
|
-
})
|
|
726
|
-
return results
|
|
727
|
-
return _engine
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
def _build_jikan_engine(spec: dict[str, Any]) -> Any:
|
|
731
|
-
"""Jikan(MyAnimeList 非官方 API)动漫元数据。"""
|
|
732
|
-
timeout = spec.get("timeout", 20)
|
|
733
|
-
|
|
734
|
-
@safe_search
|
|
735
|
-
def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
736
|
-
to = _timeout or timeout
|
|
737
|
-
q = (query or "").strip()
|
|
738
|
-
if not q:
|
|
739
|
-
return []
|
|
740
|
-
url = f"https://api.jikan.moe/v4/anime?q={urllib.parse.quote(q)}&limit={n}"
|
|
741
|
-
try:
|
|
742
|
-
data = _json(url, to, spec.get("_name", ""))
|
|
743
|
-
except Exception as e:
|
|
744
|
-
logger.warning(f"Jikan 失败: {e}")
|
|
745
|
-
return []
|
|
746
|
-
results = []
|
|
747
|
-
for _rk, a in enumerate((data.get("data") or [])[:n]):
|
|
748
|
-
if not isinstance(a, dict):
|
|
749
|
-
continue
|
|
750
|
-
title = a.get("title") or a.get("title_japanese") or ""
|
|
751
|
-
if not title:
|
|
752
|
-
continue
|
|
753
|
-
results.append({
|
|
754
|
-
"title": title[:200],
|
|
755
|
-
"url": a.get("url") or "",
|
|
756
|
-
"snippet": (f"{a.get('type','')} · {a.get('episodes','') or '-'} 集 · "
|
|
757
|
-
f"评分 {a.get('score') or '-'} · {a.get('status','')}"
|
|
758
|
-
"(MyAnimeList)")[:300],
|
|
759
|
-
"source": "jikan",
|
|
760
|
-
"score": rank_score(0.8, _rk),
|
|
761
|
-
})
|
|
762
|
-
return results
|
|
763
|
-
return _engine
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
def _build_deezer_engine(spec: dict[str, Any]) -> Any:
|
|
767
|
-
"""Deezer 音乐艺人/专辑(免认证)。"""
|
|
768
|
-
timeout = spec.get("timeout", 15)
|
|
769
|
-
|
|
770
|
-
@safe_search
|
|
771
|
-
def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
772
|
-
to = _timeout or timeout
|
|
773
|
-
q = (query or "").strip()
|
|
774
|
-
if not q:
|
|
775
|
-
return []
|
|
776
|
-
url = f"https://api.deezer.com/search/artist?q={urllib.parse.quote(q)}&limit={n}"
|
|
777
|
-
try:
|
|
778
|
-
data = _json(url, to, spec.get("_name", ""))
|
|
779
|
-
except Exception as e:
|
|
780
|
-
logger.warning(f"Deezer 失败: {e}")
|
|
781
|
-
return []
|
|
782
|
-
results = []
|
|
783
|
-
for _rk, a in enumerate((data.get("data") or [])[:n]):
|
|
784
|
-
if not isinstance(a, dict):
|
|
785
|
-
continue
|
|
786
|
-
name = (a.get("name") or "").strip()
|
|
787
|
-
if not name:
|
|
788
|
-
continue
|
|
789
|
-
results.append({
|
|
790
|
-
"title": f"{name}(音乐人)"[:200],
|
|
791
|
-
"url": a.get("link") or "",
|
|
792
|
-
"snippet": (f"Deezer 音乐人 · 专辑 {a.get('nb_album','')} · "
|
|
793
|
-
f"粉丝 {a.get('nb_fan','')}")[:300],
|
|
794
|
-
"source": "deezer",
|
|
795
|
-
"score": rank_score(0.8, _rk),
|
|
796
|
-
})
|
|
797
|
-
return results
|
|
798
|
-
return _engine
|
|
799
|
-
|
|
800
|
-
|
|
801
588
|
def _build_listenbrainz_engine(spec: dict[str, Any]) -> Any:
|
|
802
589
|
"""ListenBrainz 收听趋势(社区收听统计,补 MusicBrainz 元数据的动态维度)。"""
|
|
803
590
|
timeout = spec.get("timeout", 15)
|
|
@@ -868,49 +868,6 @@ def _build_eastmoney_engine(spec: dict[str, Any]) -> Any:
|
|
|
868
868
|
return _engine
|
|
869
869
|
|
|
870
870
|
|
|
871
|
-
# ── itotii 梗百科引擎 ────────────────────────────────────────────────────────
|
|
872
|
-
|
|
873
|
-
def _build_itotii_engine(spec: dict[str, Any]) -> Any:
|
|
874
|
-
"""itotii 梗百科(中文流行语/网络梗词条,WordPress REST API,免认证)"""
|
|
875
|
-
timeout = spec.get("timeout", 10)
|
|
876
|
-
|
|
877
|
-
@safe_search
|
|
878
|
-
def _engine(query: str, n: int = 5, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
879
|
-
import urllib.parse as up
|
|
880
|
-
to = _timeout or timeout
|
|
881
|
-
url = (
|
|
882
|
-
"https://geng.itotii.com/wp-json/wp/v2/posts?search="
|
|
883
|
-
+ up.quote(query) + f"&per_page={min(n, 10)}"
|
|
884
|
-
)
|
|
885
|
-
headers = {"User-Agent": "Mozilla/5.0"}
|
|
886
|
-
req = urllib.request.Request(url, headers=headers)
|
|
887
|
-
try:
|
|
888
|
-
with http_open(req, timeout=to, engine=spec.get("_name", "")) as resp:
|
|
889
|
-
data = json.loads(resp.read().decode("utf-8", "replace"))
|
|
890
|
-
results = []
|
|
891
|
-
for p in data:
|
|
892
|
-
title = p.get("title", {})
|
|
893
|
-
title = title.get("rendered", "") if isinstance(title, dict) else str(title)
|
|
894
|
-
content = p.get("content", {})
|
|
895
|
-
content = content.get("rendered", "") if isinstance(content, dict) else str(content)
|
|
896
|
-
title = re.sub(r"<[^>]+>", "", title).strip()
|
|
897
|
-
content = re.sub(r"<[^>]+>", "", content).strip()
|
|
898
|
-
if not title:
|
|
899
|
-
continue
|
|
900
|
-
results.append({
|
|
901
|
-
"title": title[:80],
|
|
902
|
-
"url": p.get("link", ""),
|
|
903
|
-
"snippet": f"{p.get('date', '')[:10]} | {content[:200]}",
|
|
904
|
-
"source": "itotii",
|
|
905
|
-
"score": max(1.0 - len(results) * 0.1, 0.1),
|
|
906
|
-
})
|
|
907
|
-
return results[:n]
|
|
908
|
-
except Exception as e:
|
|
909
|
-
logger.warning(f"itotii 梗百科失败: {e}")
|
|
910
|
-
return []
|
|
911
|
-
return _engine
|
|
912
|
-
|
|
913
|
-
|
|
914
871
|
# ── 百度热搜引擎 ─────────────────────────────────────────────────────────────
|
|
915
872
|
|
|
916
873
|
def _build_baidu_hot_engine(spec: dict[str, Any]) -> Any:
|
|
@@ -949,74 +906,6 @@ def _build_baidu_hot_engine(spec: dict[str, Any]) -> Any:
|
|
|
949
906
|
return _engine
|
|
950
907
|
|
|
951
908
|
|
|
952
|
-
# ── 今日头条热榜引擎 ─────────────────────────────────────────────────────────
|
|
953
|
-
|
|
954
|
-
def _build_toutiao_hot_engine(spec: dict[str, Any]) -> Any:
|
|
955
|
-
"""今日头条热榜(hot-board JSON,免认证)"""
|
|
956
|
-
timeout = spec.get("timeout", 10)
|
|
957
|
-
|
|
958
|
-
@safe_search
|
|
959
|
-
def _engine(query: str, n: int = 10, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
960
|
-
to = _timeout or timeout
|
|
961
|
-
url = "https://www.toutiao.com/hot-event/hot-board/?origin=toutiao_pc"
|
|
962
|
-
headers = {"User-Agent": "Mozilla/5.0", "Referer": "https://www.toutiao.com/"}
|
|
963
|
-
req = urllib.request.Request(url, headers=headers)
|
|
964
|
-
try:
|
|
965
|
-
with http_open(req, timeout=to, engine=spec.get("_name", "")) as resp:
|
|
966
|
-
data = json.loads(resp.read().decode("utf-8", "replace"))
|
|
967
|
-
results = []
|
|
968
|
-
for i, item in enumerate(data.get("data", [])[:n]):
|
|
969
|
-
hot = item.get("HotValue", "")
|
|
970
|
-
results.append({
|
|
971
|
-
"title": item.get("Title", "")[:60],
|
|
972
|
-
"url": item.get("Url", ""),
|
|
973
|
-
"snippet": f"热度 {hot}" if hot else "今日头条热榜",
|
|
974
|
-
"source": "toutiao_hot",
|
|
975
|
-
"score": max(1.0 - i * 0.05, 0.1),
|
|
976
|
-
})
|
|
977
|
-
return results
|
|
978
|
-
except Exception as e:
|
|
979
|
-
logger.warning(f"今日头条热榜失败: {e}")
|
|
980
|
-
return []
|
|
981
|
-
return _engine
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
# ── B站热搜引擎 ──────────────────────────────────────────────────────────────
|
|
985
|
-
|
|
986
|
-
def _build_bilibili_hot_engine(spec: dict[str, Any]) -> Any:
|
|
987
|
-
"""B站热搜(search/square 热搜词,免认证)"""
|
|
988
|
-
timeout = spec.get("timeout", 10)
|
|
989
|
-
|
|
990
|
-
@safe_search
|
|
991
|
-
def _engine(query: str, n: int = 10, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
992
|
-
import urllib.parse as up
|
|
993
|
-
to = _timeout or timeout
|
|
994
|
-
url = "https://api.bilibili.com/x/web-interface/search/square?limit=20"
|
|
995
|
-
headers = {"User-Agent": "Mozilla/5.0", "Referer": "https://www.bilibili.com"}
|
|
996
|
-
req = urllib.request.Request(url, headers=headers)
|
|
997
|
-
try:
|
|
998
|
-
with http_open(req, timeout=to, engine=spec.get("_name", "")) as resp:
|
|
999
|
-
data = json.loads(resp.read().decode("utf-8", "replace"))
|
|
1000
|
-
items = data.get("data", {}).get("trending", {}).get("list", [])
|
|
1001
|
-
results = []
|
|
1002
|
-
for i, item in enumerate(items[:n]):
|
|
1003
|
-
kw = item.get("keyword", "")
|
|
1004
|
-
if not kw:
|
|
1005
|
-
continue
|
|
1006
|
-
results.append({
|
|
1007
|
-
"title": kw[:60],
|
|
1008
|
-
"url": "https://search.bilibili.com/all?keyword=" + up.quote(kw),
|
|
1009
|
-
"snippet": "B站热搜",
|
|
1010
|
-
"source": "bilibili_hot",
|
|
1011
|
-
"score": max(1.0 - i * 0.05, 0.1),
|
|
1012
|
-
})
|
|
1013
|
-
return results
|
|
1014
|
-
except Exception as e:
|
|
1015
|
-
logger.warning(f"B站热搜失败: {e}")
|
|
1016
|
-
return []
|
|
1017
|
-
return _engine
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
909
|
# ── 知乎全网搜索(global_search,需 ZHIHU_ACCESS_SECRET)─────────────────────
|
|
1021
910
|
|
|
1022
911
|
# site:/host: 站点限定语法 → Filter host=="..." 表达式。
|
|
@@ -2026,89 +1915,6 @@ def _build_wikisource_engine(spec: dict[str, Any]) -> Any:
|
|
|
2026
1915
|
|
|
2027
1916
|
# ── 微博热搜榜引擎 ─────────────────────────────────────────────────────────────
|
|
2028
1917
|
|
|
2029
|
-
def _build_weibo_hot_engine(spec: dict[str, Any]) -> Any:
|
|
2030
|
-
"""微博热搜榜(weibo.com/ajax/side/hotSearch,免登录)
|
|
2031
|
-
|
|
2032
|
-
榜单型源:查询词只作路由触发,不参与内容过滤(见 config 的 relevance_check: false)。
|
|
2033
|
-
"""
|
|
2034
|
-
timeout = spec.get("timeout", 10)
|
|
2035
|
-
|
|
2036
|
-
@safe_search
|
|
2037
|
-
def _engine(query: str, n: int = 10, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
2038
|
-
to = _timeout or timeout
|
|
2039
|
-
url = "https://weibo.com/ajax/side/hotSearch"
|
|
2040
|
-
headers = {
|
|
2041
|
-
"User-Agent": "Mozilla/5.0",
|
|
2042
|
-
# 缺 Referer 时上游直接返回 {"error":"Forbidden"}(实测)
|
|
2043
|
-
"Referer": "https://weibo.com/",
|
|
2044
|
-
}
|
|
2045
|
-
req = urllib.request.Request(url, headers=headers)
|
|
2046
|
-
try:
|
|
2047
|
-
with http_open(req, timeout=to, engine=spec.get("_name", "")) as resp:
|
|
2048
|
-
d = json.loads(resp.read().decode("utf-8", "replace"))
|
|
2049
|
-
rows = (d.get("data") or {}).get("realtime") or []
|
|
2050
|
-
results = []
|
|
2051
|
-
for i, it in enumerate(rows):
|
|
2052
|
-
if len(results) >= n:
|
|
2053
|
-
break
|
|
2054
|
-
word = str(it.get("word") or "").strip()
|
|
2055
|
-
if not word:
|
|
2056
|
-
continue
|
|
2057
|
-
rank = it.get("realpos") or (i + 1)
|
|
2058
|
-
label = str(it.get("label_name") or "").strip()
|
|
2059
|
-
num = it.get("num") or 0
|
|
2060
|
-
results.append({
|
|
2061
|
-
"title": word[:80],
|
|
2062
|
-
"url": "https://s.weibo.com/weibo?q=" + urllib.parse.quote("#" + word + "#"),
|
|
2063
|
-
"snippet": f"微博热搜 第{rank}位 · 热度 {num}" + (f" · {label}" if label else ""),
|
|
2064
|
-
"source": "weibo_hot",
|
|
2065
|
-
"score": max(1.0 - len(results) * 0.02, 0.2),
|
|
2066
|
-
})
|
|
2067
|
-
return results
|
|
2068
|
-
except Exception as e:
|
|
2069
|
-
logger.warning(f"微博热搜榜失败: {e}")
|
|
2070
|
-
return []
|
|
2071
|
-
return _engine
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
# ── 抖音热榜引擎 ─────────────────────────────────────────────────────────────
|
|
2075
|
-
|
|
2076
|
-
def _build_douyin_hot_engine(spec: dict[str, Any]) -> Any:
|
|
2077
|
-
"""抖音热榜(iesdouyin web api,免认证,榜单型)"""
|
|
2078
|
-
timeout = spec.get("timeout", 10)
|
|
2079
|
-
|
|
2080
|
-
@safe_search
|
|
2081
|
-
def _engine(query: str, n: int = 10, _timeout: float | None = None, **kwargs) -> list[dict[str, Any]]:
|
|
2082
|
-
to = _timeout or timeout
|
|
2083
|
-
url = "https://www.iesdouyin.com/web/api/v2/hotsearch/billboard/word/"
|
|
2084
|
-
headers = {"User-Agent": "Mozilla/5.0", "Referer": "https://www.douyin.com/"}
|
|
2085
|
-
req = urllib.request.Request(url, headers=headers)
|
|
2086
|
-
try:
|
|
2087
|
-
with http_open(req, timeout=to, engine=spec.get("_name", "")) as resp:
|
|
2088
|
-
d = json.loads(resp.read().decode("utf-8", "replace"))
|
|
2089
|
-
rows = d.get("word_list") or []
|
|
2090
|
-
results = []
|
|
2091
|
-
for i, it in enumerate(rows):
|
|
2092
|
-
if len(results) >= n:
|
|
2093
|
-
break
|
|
2094
|
-
word = str(it.get("word") or "").strip()
|
|
2095
|
-
if not word:
|
|
2096
|
-
continue
|
|
2097
|
-
hot = it.get("hot_value") or 0
|
|
2098
|
-
results.append({
|
|
2099
|
-
"title": word[:80],
|
|
2100
|
-
"url": "https://www.douyin.com/search/" + urllib.parse.quote(word),
|
|
2101
|
-
"snippet": f"抖音热榜 第{i + 1}位 · 热度 {hot}",
|
|
2102
|
-
"source": "douyin_hot",
|
|
2103
|
-
"score": max(1.0 - len(results) * 0.02, 0.2),
|
|
2104
|
-
})
|
|
2105
|
-
return results
|
|
2106
|
-
except Exception as e:
|
|
2107
|
-
logger.warning(f"抖音热榜失败: {e}")
|
|
2108
|
-
return []
|
|
2109
|
-
return _engine
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
1918
|
# ── CSDN 搜索 ────────────────────────────────────────────────────────────────
|
|
2113
1919
|
|
|
2114
1920
|
_EM_TAG_RE = re.compile(r"</?em>")
|