fix(v2.1.1): 修复执行问题记录中的真实 bug + 文档对齐
源码修复(5 项): 1. search.py --time-range choices 加入 week(对齐 SearXNG API 四档) 2. fetch.py stdlib 路径处理 gzip/deflate 解压(被沙箱伪响应掩盖的真实 bug, 无 requests 环境抓取压缩服务器会全页 U+FFFD 乱码) 3. search.py --research 模式实现跨角度合并去重,输出 merged_results 字段 (兑现文档承诺 "Results are merged and deduplicated") 4. search.py fetch_page 返回 error_code 字段 + AdaptiveThrottle 用 E_RATE_LIMIT 结构化检测 429(原字符串匹配 "429" 会漏判 "Too Many Requests") 5. search.py _retry_with_backoff 复用 compute_backoff_delay(60s 封顶) + 处理 Retry-After header,与 fetch.py 保持一致 增强(3 项): - common.py 精确化 baidu 子域列表(pan.baidu.com/cloud.baidu.com 不再误伤) - search.py expand_research_queries 根据主题语言切换中英文后缀 - search.py 新增 _warn_unresponsive_engines,识别实例侧引擎挂起并提示 文档/版本: - _config.py VERSION 2.1.0 → 2.1.1 - SKILL.md 同步更新(time-range week、merged_results、error_code、baidu 精确化) - README.md 同步更新 + 测试数量 503 → 539 测试: 539 个全部通过,含 6 个新增验证测试
This commit is contained in:
@@ -113,12 +113,21 @@ class TestIsHardBlockedDomain:
|
||||
assert is_hard_blocked_domain("https://github.com/python/cpython") is False
|
||||
|
||||
def test_baidu_search_not_blocked(self):
|
||||
"""baidu.com search page is NOT in the hard-blocked list — only subdomains
|
||||
like baike.baidu.com, zhidao.baidu.com are."""
|
||||
# Actually, baidu.com is in _SUBDOMAIN_BLOCKED, so www.baidu.com matches.
|
||||
# This is intentional — Baidu's main search also has strong anti-bot.
|
||||
"""www.baidu.com search page is in the hard-blocked list.
|
||||
v2.1.0: moved from _SUBDOMAIN_BLOCKED (baidu.com) to HARD_BLOCKED_DOMAINS
|
||||
(www.baidu.com) to avoid blocking pan.baidu.com / cloud.baidu.com."""
|
||||
assert is_hard_blocked_domain("https://www.baidu.com/s?wd=test") is True
|
||||
|
||||
def test_baidu_pan_not_blocked(self):
|
||||
"""pan.baidu.com (百度网盘) should NOT be blocked after v2.1.0 fix.
|
||||
Previously matched by _SUBDOMAIN_BLOCKED 'baidu.com' — now only
|
||||
www/baike/zhidao/tieba/wenku are in the precise list."""
|
||||
assert is_hard_blocked_domain("https://pan.baidu.com/s/abc123") is False
|
||||
|
||||
def test_baidu_cloud_not_blocked(self):
|
||||
"""cloud.baidu.com (百度智能云) should NOT be blocked after v2.1.0 fix."""
|
||||
assert is_hard_blocked_domain("https://cloud.baidu.com/product/abc") is False
|
||||
|
||||
def test_empty_url(self):
|
||||
assert is_hard_blocked_domain("") is False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user