Install
openclaw skills install youtube-search-extractorYouTube搜索结果视频链接提取器 - 可以搜索特定关键词并提取视频链接
openclaw skills install youtube-search-extractor这是一个用于从YouTube搜索结果中自动提取视频链接的技能。它可以:
agent-browser工具自动执行YouTube搜索npm install -g agent-browser
agent-browser install
agent-browser install --with-deps
git clone https://github.com/vercel-labs/agent-browser
cd agent-browser
pnpm install
pnpm build
agent-browser install
# 搜索关键词并保存链接到文件
npm run search -- "关键词" "输出文件名"
npm run search -- "hydrasynth 实战应用" hydrasynth_links
cd /Users/happy/.openclaw/workspace/skills/youtube-search-extractor
python3 youtube_search_extractor.py "关键词" "输出文件名"
youtube_search_extractor.py - 主要的搜索和提取脚本SKILL.md - 技能文档package.json - npm项目配置.clawhub/ - ClawHub配置目录<output_file>.html - YouTube搜索结果的HTML页面<output_file>_links.txt - 提取的视频链接列表agent-browser进行浏览器自动化"Hydrasynth practical applications""hydrasynth 实战应用""OpenClaw tutorial 教程"npm run search -- "OpenClaw tutorial" openclaw_links
python3 youtube_search_extractor.py "hydrasynth 实战应用" hydrasynth_links
cd /Users/happy/.openclaw/workspace/skills/youtube-search-extractor
python3 youtube_search_extractor.py "AI音乐创作" ai_music_links
python3 youtube_search_extractor.py [关键词] [输出文件名] [可选参数]
可选参数:
--headless # 无头浏览器模式(默认:启用)
--wait-time <秒数> # 页面加载等待时间(默认:5秒)
--max-links <数量> # 最大链接数(默认:50个)
--proxy <地址> # 使用代理服务器
创建youtube_search_config.json配置文件:
{
"browser": {
"headless": true,
"wait_time": 5,
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
},
"extractor": {
"max_links": 50,
"filter_relevance": true
}
}
安装依赖失败
npm install -g agent-browser --force
浏览器启动失败
agent-browser install --with-deps
网络连接问题
# 使用代理
python3 youtube_search_extractor.py "关键词" "输出文件名" --proxy "http://localhost:8080"
# 启用详细输出
python3 youtube_search_extractor.py "关键词" "输出文件名" --debug
在search_templates目录中添加搜索模板:
{
"name": "Hydrasynth Search",
"keywords": ["hydrasynth", "Hydrasynth", "hydra synth"],
"description": "搜索Hydrasynth合成器相关的内容",
"filters": ["hydrasynth"]
}
修改youtube_search_extractor.py中的链接匹配模式:
def extract_video_links(html_content):
patterns = [
r'href=["\'](/watch\?v=[\w-]+[^"\']*)["\']',
r'href=["\'](https?://(?:www\.)?youtube\.com/watch\?v=[\w-]+[^"\']*)["\']',
r'href=["\'](https?://(?:www\.)?youtu\.be/[\w-]+[^"\']*)["\']'
]
# 其他提取逻辑...
本技能采用MIT许可证,可自由使用、修改和分发。