← 返回 Skills 市场
chaoking

baidu_search

作者 chaoking · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
103
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install baidu-search-for-free
功能描述
Perform Baidu search to retrieve Chinese web results with titles, summaries, and links, and parse webpage content from search results.
使用说明 (SKILL.md)

Baidu Search

使用 baidusearch 库进行百度搜索,并支持解析搜索结果网页内容。

Quick Start

1. 百度搜索

from baidusearch.baidusearch import search

# 基础搜索(默认返回10条结果)
results = search('搜索关键词')

# 指定返回结果数量
results = search('搜索关键词', num_results=20)

返回结果格式:

[
    {
        'title': '结果标题',
        'abstract': '结果摘要',
        'url': '结果链接',
        'rank': 1
    },
    ...
]

2. 解析网页内容

from scripts.fetch_url import fetch_url

# 获取并解析网页内容
content = fetch_url('http://example.com/article')
print(content['title'])
print(content['text'])

3. 搜索并解析完整流程

from baidusearch.baidusearch import search
from scripts.fetch_url import fetch_url

# 第一步:搜索
results = search('南京江宁龙虾政策', num_results=5)

# 第二步:解析第一条结果的网页内容
if results:
    first_url = results[0]['url']
    content = fetch_url(first_url)
    print(f"标题: {content['title']}")
    print(f"正文: {content['text'][:500]}...")

命令行使用

搜索:

python3 scripts/baidu_search.py "搜索关键词" --num 10

解析网页:

python3 scripts/fetch_url.py "http://example.com"
python3 scripts/fetch_url.py "http://example.com" --max-chars 2000

搜索并解析(完整流程):

python3 scripts/search_and_fetch.py "搜索关键词" --num 5

Workflow

  1. 安装依赖: 确保已安装所需库

    pip3 install --user baidusearch requests beautifulsoup4 lxml
    
  2. 执行搜索: 使用 baidusearch 获取搜索结果

  3. 解析网页: 使用 fetch_url 解析搜索结果中的网页内容

  4. 注意事项:

    • 建议每次搜索间隔 15 秒以上
    • 频繁使用可能导致 IP 被百度封禁
    • 遇到 503 错误请等待 1 分钟后重试
    • 部分网站可能有反爬机制,解析可能失败

Resources

scripts/

  • baidu_search.py - 百度搜索脚本,支持命令行参数调用
  • fetch_url.py - 网页内容抓取和解析脚本
  • search_and_fetch.py - 搜索并自动解析网页内容的完整流程脚本
安全使用建议
This skill appears to implement Baidu searching and HTML parsing as described, but consider the following before installing or running it in production: - SSL verification disabled: fetch_url uses requests.get(..., verify=False). That makes HTTPS requests accept invalid certificates and is a security risk (MITM, spoofed pages). Consider changing verify=True or making certificate validation configurable. - Arbitrary URL fetch / SSRF risk: the scripts will fetch any URL you (or search results) provide. If the host running the skill has network access to internal endpoints (localhost, 169.254.169.254, internal metadata services), an attacker or a crafted query could cause the agent to retrieve sensitive internal data. Run this skill in a restricted network environment, or implement URL whitelisting/validation. - Rate-limiting mismatch: SKILL.md recommends waiting >=15s between searches to avoid IP bans, but search_and_fetch.py sleeps 1s between fetches. If you care about being polite/avoiding bans, adjust the sleep interval in the script or add a configurable throttle. - Dependency safety: the skill depends on the third-party 'baidusearch' package. Verify that package and its version are trustworthy before installing, especially if installing globally. Prefer installing into an isolated virtualenv. - General sandboxing: because the skill can make outbound HTTP requests and return arbitrary webpage content, avoid running it in environments that grant access to sensitive internal networks or cloud metadata endpoints. If you accept these risks and run the skill in a controlled/sandboxed environment (or fix the verify=False and add URL whitelisting/rate-limiting), the skill is coherent with its declared purpose. If you need higher assurance, request information about the 'baidusearch' dependency and consider altering the code to enforce safe defaults (verify=True, strict URL checks, configurable delay).
功能分析
Type: OpenClaw Skill Name: baidu-search-for-free Version: 1.0.0 The skill bundle provides functionality for Baidu searching and web scraping, which are high-risk network activities. A significant security vulnerability is present in `scripts/fetch_url.py`, where SSL certificate verification is explicitly disabled (`verify=False`), potentially exposing the agent to Man-in-the-Middle (MITM) attacks. While the code appears to align with its stated purpose and shows no clear signs of intentional malice or data exfiltration, the combination of arbitrary URL fetching and disabled transport security warrants a suspicious classification.
能力评估
Purpose & Capability
Name/description claim: perform Baidu searches and parse webpages. The code and instructions align with that purpose: they call baidusearch.search and use fetch_url to GET and parse HTML. Required files and imports match the stated functionality and no unrelated credentials or binaries are requested.
Instruction Scope
SKILL.md and scripts instruct the agent to fetch and parse arbitrary URLs returned by Baidu (and the fetch_url script accepts any URL). That is coherent for a crawler, but it means the skill can be used to fetch arbitrary network endpoints (including internal/private addresses) — a server-side request/SSRF risk if run in an environment with access to internal services. Additionally, fetch_url disables SSL verification (requests.get(..., verify=False)) which weakens transport security and can lead to accepting spoofed responses. The SKILL.md suggests waiting 15 seconds between searches to avoid bans, but search_and_fetch.py uses time.sleep(1) between fetches — a mismatched guidance vs implementation that could lead to more aggressive scraping than recommended.
Install Mechanism
Instruction-only install (no install spec). Dependencies are standard Python packages (baidusearch, requests, beautifulsoup4, lxml) and the SKILL.md instructs how to pip-install them. No downloads from arbitrary URLs or archive extraction are present in the bundle.
Credentials
The skill declares no required environment variables or credentials. The code does not access environment variables or local config files. The lack of credential requests is proportionate to the stated purpose.
Persistence & Privilege
always is false and the skill is user-invocable / can be invoked autonomously (platform default). The skill does not request persistent system presence or modify other skills' configs. No privilege escalation behavior detected in provided code.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install baidu-search-for-free
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /baidu-search-for-free 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Migrated to using the baidusearch library for Baidu search results. - Added ability to parse and extract content from search result webpages. - New scripts: baidu_search.py (search), fetch_url.py (fetch & parse webpage), and search_and_fetch.py (integrated workflow). - Command-line support for search, webpage parsing, and full search+parse processes. - Documentation updated for workflow, result structure, and usage examples. - Removed legacy scripts and API key requirements.
元数据
Slug baidu-search-for-free
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

baidu_search 是什么?

Perform Baidu search to retrieve Chinese web results with titles, summaries, and links, and parse webpage content from search results. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 103 次。

如何安装 baidu_search?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install baidu-search-for-free」即可一键安装,无需额外配置。

baidu_search 是免费的吗?

是的,baidu_search 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

baidu_search 支持哪些平台?

baidu_search 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 baidu_search?

由 chaoking(@chaoking)开发并维护,当前版本 v1.0.0。

💬 留言讨论