mcpField
V
videos-search

videos-search

github.com/brave生产力1921.2k 次安装11 周前更新
代码仓库

关于 videos-search

videos-search 是通过 Brave Search API 搜索视频的技能,适合视频内容研究和元数据采集。结果包含时长、播放量、创作者及标签等视频信息。

主要功能

  1. 01按关键词搜索视频
  2. 02按国家、语言和时间筛选
  3. 03按网站限定搜索范围
  4. 04返回时长、播放量和创作者信息
  5. 05支持分页与最多 50 条结果

适用场景

  1. 01查找特定主题的教程与讲解视频
  2. 02监测近期发布的视频
  3. 03收集视频元数据用于分析或整理

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/brave/brave-search-skills --skill videos-search

安装后在 Claude Code 中输入/videos-search确认已加载。

详细介绍

视频搜索

需要 API 密钥:在 https://api.search.brave.com 获取

套餐:包含在 Search 套餐中。参见 https://api-dashboard.search.brave.com/app/subscriptions/subscribe

快速开始(cURL)

基本搜索
curl -s "https://api.search.brave.com/res/v1/videos/search?q=python+tutorial" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
使用参数
curl -s "https://api.search.brave.com/res/v1/videos/search" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  -G \
  --data-urlencode "q=machine learning explained" \
  --data-urlencode "country=US" \
  --data-urlencode "search_lang=en" \
  --data-urlencode "count=20" \
  --data-urlencode "freshness=pm"

端点

GET https://api.search.brave.com/res/v1/videos/search
POST https://api.search.brave.com/res/v1/videos/search

身份验证:X-Subscription-Token: <API_KEY> 请求头

注意:支持 GET 和 POST 方法。POST 适用于较长的查询。

参数

参数类型必填默认值描述
qstring是-搜索查询(1-400 个字符,最多 50 个单词)
countrystring否US搜索国家(2 个字母的国家代码或 ALL)
search_langstring否en语言偏好(至少 2 个字符的语言代码)
ui_langstring否en-USUI 语言(例如,“en-US”)
countint否20结果数量(1-50)
offsetint否0页面偏移量(0-9)
safesearchstring否moderate成人内容过滤(off/moderate/strict)
freshnessstring否-时间过滤(pd/pw/pm/py 或日期范围)
spellcheckbool否true自动更正查询
operatorsbool否true应用搜索运算符
include_fetch_metadatabool否false在结果中包含 fetched_content_timestamp
时间范围值
值描述
pd过去一天(24 小时)
pw过去一周(7 天)
pm过去一个月(31 天)
py过去一年(365 天)
YYYY-MM-DDtoYYYY-MM-DD自定义日期范围

响应格式

{
  "type": "videos",
  "query": {
    "original": "python tutorial",
    "spellcheck_off": false
  },
  "extra": {
    "might_be_offensive": false
  },
  "results": [
    {
      "type": "video_result",
      "title": "Python Tutorial for Beginners",
      "url": "https://www.youtube.com/watch?v=rfscVS0vtbw",
      "description": "Learn Python programming from scratch...",
      "age": "February 12, 2025",
      "page_age": "2025-02-12T00:00:00",
      "page_fetched": "2025-02-12T15:00:00Z",
      "thumbnail": {
        "src": "https://imgs.search.brave.com/...",
        "original": "https://i.ytimg.com/vi/rfscVS0vtbw/hqdefault.jpg"
      },
      "video": {
        "duration": "03:45:00",
        "views": 1523000,
        "creator": "freeCodeCamp",
        "publisher": "YouTube",
        "requires_subscription": false,
        "tags": ["python", "programming"],
        "author": {
          "name": "freeCodeCamp.org",
          "url": "https://www.youtube.com/@freecodecamp"
        }
      },
      "meta_url": {
        "scheme": "https",
        "netloc": "youtube.com",
        "hostname": "www.youtube.com",
        "favicon": "https://imgs.search.brave.com/...",
        "path": "\u203a watch"
      }
    }
  ]
}

响应字段

字段类型描述
typestring始终为 "videos"
query.originalstring原始搜索查询
query.alteredstring?拼写检查修正后的查询(如果有更改)
query.cleanedstring?清理/规范化后的查询
query.spellcheck_offbool?是否禁用了拼写检查
query.show_strict_warningbool?严格安全搜索是否屏蔽了成人内容结果
query.search_operatorsobject?已应用的搜索运算符(applied、cleaned_query、sites)
extra.might_be_offensivebool结果是否可能包含冒犯性内容
results[].typestring始终为 "video_result"
results[].urlstring视频的来源 URL
results[].titlestring视频标题
results[].descriptionstring?视频描述
results[].agestring?人类可读的发布时间(例如 "6 months ago")或绝对日期(例如 "February 12, 2025")
results[].page_agestring?来源提供的页面时间(ISO 日期时间)
results[].page_fetchedstring?页面上次抓取的 ISO 日期时间(例如 2025-02-12T15:00:00Z)
results[].fetched_content_timestampint?抓取时间戳(仅在 include_fetch_metadata=true 时提供)
results[].video.durationstring?时间字符串(格式不固定)
results[].video.viewsint?整数形式的观看次数
results[].video.creatorstring?频道/创作者名称
results[].video.publisherstring?平台(YouTube、Vimeo 等)
results[].video.requires_subscriptionbool?视频是否需要订阅
results[].video.tagslist[str]?与视频相关的标签
results[].video.authorobject?作者资料
results[].video.author.namestring作者姓名
results[].video.author.urlstring作者资料 URL
results[].video.author.long_namestring?作者完整名称
results[].video.author.imgstring?作者资料图片 URL
results[].thumbnail.srcstring提供的缩略图 URL
results[].thumbnail.originalstring?原始缩略图 URL
results[].meta_url.schemestring?URL 协议方案
results[].meta_url.netlocstring?网络位置
results[].meta_url.hostnamestring?转为小写的域名
results[].meta_url.faviconstring?网站图标 URL
results[].meta_url.pathstring?URL 路径

搜索运算符

使用搜索运算符来筛选结果:

  • site:youtube.com - 限定在特定网站中搜索
  • "exact phrase" - 匹配确切短语
  • -exclude - 排除词语

设置 operators=false 可禁用运算符解析。

使用场景

  • 视频内容研究:按主题查找教程、讲解视频和评论。使用 video.duration、video.views 和 video.creator 元数据,以编程方式筛选和排列结果。需要专用视频索引、更丰富的元数据(时长、观看次数、创作者、标签)以及每次请求最多 50 条结果时,优先使用 videos-search 而不是 web-search。
  • 最新视频监控:使用 freshness=pd 或 freshness=pw,追踪热门话题或特定主题下新发布的视频内容。
  • 特定平台搜索:使用 site:youtube.com 或 site:vimeo.com 运算符,针对特定视频平台搜索。
  • 视频元数据提取:获取观看次数、时长、创作者信息和标签,用于分析、内容整理或推荐系统。

注意事项

  • 分页:将 offset(0-9)与 count 配合使用可获取更多结果
  • 最多结果数:每次请求最多返回 50 条结果

评论

支持 Markdown