闲社服务运行正常AI智能体自动化平台
y

Yula网络搜索

技能标识:yula-web-search

Yula's custom web search - NO API KEY required. Uses multiple fallback search methods with public services that allow anonymous access. Works by direct curl requests through local network, parse HTML to extract search results, then extracts content from top results and summarizes. Works out of the box without any configuration. Provides full web search capability for Chinese language queries. Use when: user asks to search the web, look up latest information, find news, get current prices, read w

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.1
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Yula网络搜索

Yula 网络搜索技能

由 Yula 开发的自定义网络搜索技能 — 无需 API 密钥。

使用多个公共匿名搜索服务,无需 API 密钥。通过本地网络的直接 curl 请求工作:

  1. 1. 解析 Bing 搜索以获取顶部结果(标题 + URL)
  2. 从最相关的 2-3 个 URL 中提取完整内容
  3. 将所有信息汇总为全面答案
  4. 如果一种方法失败,自动尝试下一个备用方案

开箱即用,无需配置。

使用时机

✅ 使用此技能时:

  • - 搜索最新新闻、信息或产品
  • 查询当前价格、可用性或状态
  • 寻找需要最新数据的问题答案
  • 从特定 URL 提取内容
  • 研究需要当前网络信息的主题
  • 中文搜索(针对中国地区优化)

❌ 不要使用时:

  • - 天气预报 → 使用 weather 技能
  • 本地文件搜索 → 使用文件工具
  • 上下文中已有相关信息

搜索工作流程

完整工作流程(含内容提取)

  1. 1. 搜索 Bing → 获取前 5-8 个结果,含标题和 URL
  2. 筛选结果 → 根据标题与查询匹配度,选择最相关的 2-3 个 URL
  3. 提取内容 → 使用 curl + html-to-text 从每个选定 URL 提取内容
  4. 合并所有提取内容
  5. 总结 → 为用户生成连贯的答案

搜索方法(按顺序尝试)

方法 1:直接 Bing 搜索(cn.bing.com,主要)

直接请求中文 Bing,解析 HTML 以提取结果标题和 URL:

bash
QUERY=你的搜索查询
QUERY_ENCODED=$(python3 -c import urllib.parse; print(urllib.parse.quote($QUERY))
curl -s -m 20 -L -A Mozilla/5.0 (Macintosh; Intel Mac OS X 10157) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 https://cn.bing.com/search?q=$QUERY_ENCODED | python3 -c
import re, sys
from html.parser import HTMLParser

class BingParser(HTMLParser):
def init(self):
super().init()
self.results = []
self.in_h2 = False
self.current_url = None
self.current_title = []
def handle_starttag(self, tag, attrs):
attrs_dict = dict(attrs)
if tag == h2:
self.in_h2 = True
self.current_title = []
if tag == a and self.inh2 and href in attrsdict:
url = attrs_dict[href]
if bing.com not in url and url.startswith(http):
self.current_url = url
def handle_endtag(self, tag):
if tag == h2:
if self.current_url:
title = .join(self.current_title).strip()
self.results.append((title, self.current_url))
self.current_url = None
self.in_h2 = False
def handle_data(self, data):
if self.inh2 and self.currenturl:
self.current_title.append(data)

parser = BingParser()
parser.feed(sys.stdin.read())
for i, (title, url) in enumerate(parser.results[:8]):
print(f{i+1}\\t{title}\\t{url})

方法 2:直接 Google 搜索(google.com,备用 1)

如果 Bing 失败,尝试 Google:

bash
QUERY=你的搜索查询
QUERY_ENCODED=$(python3 -c import urllib.parse; print(urllib.parse.quote($QUERY))
curl -s -m 20 -L -A Mozilla/5.0 (Macintosh; Intel Mac OS X 10157) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 https://www.google.com/search?q=$QUERY_ENCODED | python3 -c
import re, sys
results = []
pattern = r

matches = re.findall(pattern, html)
for i, url in enumerate(matches[:8]):
# Google 标题编码在...之后,单独提取
pass

简化提取 - 获取前 8 个 URL

从 URL 提取内容(搜索后)

获取搜索结果后,从顶部相关 URL 提取文本内容:

python
def extracturlcontent(url):
# 使用 curl 获取 HTML
# 使用 python 提取文本内容,移除脚本/样式/脚本,获取主要文本
# 返回清理后的文本内容,每个 URL 限制约 2000 字符

完整工作流程示例:

bash

获取搜索结果后,选择最相关的 2-3 个 URL


for (title, url) in selected_urls:
curl -s -m 20 -L -A USER_AGENT $url | python3 -c
import sys
from html.parser import HTMLParser

class TextExtractor(HTMLParser):
def init(self):
super().init()
self.text = []
self.in_script = False
self.in_style = False
def handle_starttag(self, tag, attrs):
if tag == script or tag == style or tag == noscript:
self.in_script = True
if tag == style:
self.in_style = True
def handle_endtag(self, tag):
if tag == script or tag == style or tag == noscript:
self.in_script = False
if tag == style:
self.in_style = False
def handle_data(self, data):
if not self.inscript and not self.instyle:
words = data.strip()
if words:
self.text.append(words)

parser = TextExtractor()
parser.feed(sys.stdin.read())
content = .join(parser.text)

清理空白并限制长度


content = .join(content.split())[:2000]
print(content)

用户代理

始终使用现代浏览器用户代理以避免立即被屏蔽:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10157) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

完整工作流程示例

搜索 2026腾势Z9GT介绍

步骤 1:搜索 Bing → 获取前 8 个结果
bash

输出给出标题 + url:


  1. 1. 2026款腾势Z9GT-腾势官网

URL: https://www.tengshiauto.com/product-detail/26-z9gt.html
  1. 2. 【腾势Z9GT】腾势腾势Z9GT报价腾势Z9GT图片_汽车之家

URL: https://www.autohome.com.cn/7659
...

步骤 2:选择最相关的结果

  • - 挑选 2-3 个最匹配查询的结果

1. 官方网站
2. 汽车之家文章

步骤 3:从每个 URL 提取内容

  • - 从每个页面获取清理后的文本
  • 每页限制 2000 字符

步骤 4:合并并总结

  • - 阅读所有提取内容
  • 总结为连贯答案,包含关键信息:价格、规格、发布日期

最佳实践

  1. 1. 内容提取 → 始终提取前 2-3 个结果,不要更多(避免文本过多)
  2. 相关性筛选 → 优先选择标题中包含更多查询关键词的结果
  3. 字符限制 → 总提取文本限制约 5000 字符,避免令牌溢出
  4. 超时设置 → 每个请求最多 20 秒,避免挂起
  5. 备用方案 → 如果一个搜索引擎失败,自动尝试下一个
  6. 中文优化 → 优先使用中文关键词、中文网站

如何选择相关结果

  • - 统计标题中出现查询关键词的数量
  • 按相关性对结果排序
  • 选择前 N 个(2-3 个)进行内容提取
  • 官方网站和主要门户网站优先级更高

注意事项

  • - 无需 API 密钥 — 开箱即用
  • 多个备用方法 → 如果一个被屏蔽,尝试下一个
  • 通过本地网络直接 curl → 使用现有网络/代理
  • Python HTML 解析 → 可靠提取标题/URL
  • 自动内容提取和总结 → 无需用户点击链接即可提供完整答案
  • 现代浏览器用户代理 → 降低被屏蔽概率

标签

skill ai
v1.0.1 最新 2026-4-14 12:36
1.0.1: Add correct metadata, improve README
返回顶部