images-search

images-search

热门

用于图片搜索。返回带有标题、来源URL和缩略图的图片。支持安全搜索过滤。最多返回200条结果。

168Star
11Fork
更新于 2026/8/18
SKILL.md
只读
名称
images-search
描述

用于图片搜索。返回带有标题、来源URL和缩略图的图片。支持安全搜索过滤。最多返回200条结果。

图片搜索

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

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

快速开始(cURL)

基本搜索

curl -s "https://api.search.brave.com/res/v1/images/search?q=mountain+landscape" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"

带参数

curl -s "https://api.search.brave.com/res/v1/images/search" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  -G \
  --data-urlencode "q=northern lights photography" \
  --data-urlencode "country=US" \
  --data-urlencode "search_lang=en" \
  --data-urlencode "count=20" \
  --data-urlencode "safesearch=strict"

端点

GET https://api.search.brave.com/res/v1/images/search

认证X-Subscription-Token: <API_KEY> 请求头

参数

参数 类型 必填 默认值 描述
q string - 搜索查询(1-400字符,最多50个单词)
country string US 搜索国家(两位国家代码或ALL
search_lang string en 2个以上字符的语言代码
count int 50 返回的结果数(1-200)
safesearch string strict offstrict(图片搜索无moderate选项)
spellcheck bool true 自动纠正查询;纠正后的查询在query.altered

响应格式

{
  "type": "images",
  "query": {
    "original": "mountain landscape",
    "altered": null,
    "spellcheck_off": false,
    "show_strict_warning": false
  },
  "results": [
    {
      "type": "image_result",
      "title": "Beautiful Mountain Landscape",
      "url": "https://example.com/mountain-photo",
      "source": "example.com",
      "page_fetched": "2025-09-15T10:30:00Z",
      "thumbnail": {
        "src": "https://imgs.search.brave.com/...",
        "width": 200,
        "height": 150
      },
      "properties": {
        "url": "https://example.com/images/mountain.jpg",
        "placeholder": "https://imgs.search.brave.com/placeholder/...",
        "width": 1920,
        "height": 1080
      },
      "meta_url": {
        "scheme": "https",
        "netloc": "example.com",
        "hostname": "example.com",
        "favicon": "https://imgs.search.brave.com/favicon/...",
        "path": "/mountain-photo"
      },
      "confidence": "high"
    }
  ],
  "extra": {
    "might_be_offensive": false
  }
}

响应字段

字段 类型 描述
type string 始终为"images"
query.original string 原始查询
query.altered string? 拼写纠正后的查询(若无纠正则为null)
query.spellcheck_off bool? 是否禁用了拼写检查
query.show_strict_warning bool? 严格安全搜索是否隐藏了相关结果
results[] array 图片结果列表
results[].type string 始终为"image_result"
results[].title string? 图片标题
results[].url string? 找到图片的页面URL
results[].source string? 来源域名
results[].page_fetched string? 上次页面抓取的ISO日期时间
results[].thumbnail.src string? Brave代理的缩略图URL(约500像素宽)
results[].thumbnail.width int? 缩略图宽度
results[].thumbnail.height int? 缩略图高度
results[].properties.url string? 原始全尺寸图片URL
results[].properties.placeholder string? 低分辨率占位图URL(Brave代理)
results[].properties.width int? 原始图片宽度(可能为null)
results[].properties.height int? 原始图片高度(可能为null)
results[].meta_url.scheme string? URL协议
results[].meta_url.netloc string? 网络位置
results[].meta_url.hostname string? 小写域名
results[].meta_url.favicon string? 网站图标URL
results[].meta_url.path string? URL路径
results[].confidence string? 相关性:lowmediumhigh
extra.might_be_offensive bool 结果是否可能包含冒犯性内容

使用场景

  • 视觉内容发现:构建图片画廊、情绪板或视觉研究工具。使用count=200获取全面覆盖。当需要图片特定元数据(尺寸、缩略图)时,优先于web-search
  • 内容增强:为文章或生成的内容添加相关图片。使用countrysearch_lang定位受众的语言区域。
  • 安全图片检索:默认Safesearch=strict确保开箱即用的家庭友好结果。只有两种模式(off/strict)——没有moderate选项,不同于网页/视频/新闻搜索。
  • 大批量检索:每个请求最多200张图片(网页搜索为20,视频/新闻为50)。非常适合批量图片获取或视觉分析管道。

注意事项

  • 安全搜索:图片搜索默认strict(比网页搜索更严格)
  • 高容量:每个请求最多返回200条结果
  • 缩略图:Brave代理以保护用户隐私(500像素宽)。使用properties.url获取原始全分辨率图片。
  • 尺寸:某些图片可能缺少properties.width/height
  • 占位图properties.placeholder是低分辨率URL(非内联base64),适合渐进加载用户体验