黑色星期五终身优惠:一次付款,$129 起,每月获得积分。网络星期一(30 日)截止。立即领取 →
YaGET/api/v2/yandex-search/

Yandex 搜索爬虫 API

最后更新: · REST · JSON

简要回答

发送 GET https://api.scrapier.io/api/v2/yandex-search/?queries=python tutorial,并在 X-API-Key 请求头中提供你的密钥。结果页将以 JSON 返回。每页结果 10 积分;失败的调用免费。

  • 每页结果 10 积分
  • 失败的调用免费
  • 没有速率限制
复制给 你的 AI 智能体
API

调用 Yandex 搜索爬虫 API

在你自己的应用、脚本或智能体中使用 Yandex 搜索爬虫 API。你需要一个 Scrapier 账号,以及控制台中的 API 密钥。请选择一种语言。

search.py
import requests# Replace YOUR_API_KEY with the key from your Scrapier dashboardAPI_KEY = "YOUR_API_KEY"params = {    "queries": "python tutorial",    "language": "en",}r = requests.get(    "https://api.scrapier.io/api/v2/yandex-search/",    headers={"X-API-Key": API_KEY},    params=params,    timeout=210,)r.raise_for_status()# The result sits under data.resultsresult = r.json()["data"]["results"]print(result)

Python 版 Yandex 搜索爬虫 API

只需普通的 requests,无需 SDK。每个响应都是类型化 JSON。

安装

$ pip install requests

其他调用方式

试用区

Yandex 搜索爬虫 API 交互式试用

编辑请求,观察代码更新,然后运行。没有密钥时它显示目录示例,不计费。使用你的密钥时,它会从浏览器发出真实调用;密钥只会发送到 api.scrapier.io,从不存储。

没有密钥?运行目录示例。
就绪延迟 —已计费积分:0
请求已就绪GET /api/v2/yandex-search/?queries=python tutorial

点击运行请求发送。没有密钥时你得到的是目录示例。

正在发送请求…
错误

失败的调用不计费。

导入到 PostmanOpenAPI 规范

无论输入什么,示例都相同:它展示的是响应结构,而不是你输入的账户。

示例响应,目录示例,2026 年11月 9 日
{
  "success": true,
  "data": {
    "queries": "python tutorial",
    "page": 1,
    "page_size": 10,
    "results": [
      {
        "position": 1,
        "type": "organic",
        "url": "https://docs.python.org/3/tutorial/index.html",
        "title": "The Python Tutorial — Python 3.14.7 documentation",
        "display_url": "Docs.Python.org",
        "snippet": "This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.",
        "page": 0,
        "query": "python tutorial"
      }
    ],
    "next_cursor": "eyJpIjoicHl0aG9uIHR1dG9yaWFsIiwibGFuZyI6ImVuIiwicCI6MSwiaCI6ImFiYzEyMyIsInMiOltdfQ"
  }
}
数据

你可以提取的数据

Yandex 搜索爬虫提取 Yandex 针对某个搜索词返回的结果页,每次调用一页:包括每条结果的名次、类型、目标 URL、标题、显示 URL 和摘要,以及页码和对应的查询。下面的每个字段都来自目录中的示例响应,均为类型化 JSON。

结果

响应中有 6 个字段。

  • position
  • type
  • url
  • title
  • display_url
  • snippet

页码与查询

响应中有 2 个字段。

  • page
  • query

响应结构与分页

响应中有 5 个字段。

  • success
  • data.queries
  • data.page
  • data.page_size
  • data.next_cursor
结构

响应结构参考

示例响应中的每个字段。字段名每次调用都保持不变。

字段类型示例说明
results.positioninteger1结果在页面上的位置
results.typestring"organic"结果类型,例如 organic
results.urlstring"https://docs.python.org/3/tutorial/index.ht…"结果的目标 URL
results.titlestring"The Python Tutorial — Python 3.14.7 documen…"Yandex 显示的结果标题
results.display_urlstring"Docs.Python.org"标题下方显示的主机名
results.snippetstring"This tutorial introduces the reader informa…"标题下方的摘要文本
results.pageinteger0结果所在的 Yandex 页索引(从零开始)
results.querystring"python tutorial"产生该结果的查询
successbooleantrue每个 200 响应都为 true
data.queriesstring"python tutorial"你的搜索词,原样回显
data.pageinteger1本次响应的页码
data.page_sizeinteger10每页结果数
data.next_cursorstring"eyJpIjoicHl0aG9uIHR1dG9yaWFsIiwibGFuZyI6ImV…"作为 cursor 传回即可获取下一页;最后一页为 null
参数

请求参数参考

名称类型必填默认值说明示例
queriesstring是—yandex.com 上的搜索词。每次调用一个。首次调用必填。别名:query、qpython tutorial
cursorstring否—原样传回上一个响应的 data.next_cursor,即可获取下一页;null 表示最后一页—
languagestring否en地区排名,默认 en。可选值:en、ru、uk、de、fr、tr、be、kk、uz、az、lv、lt、et。锁定在 cursor 中en
use_proxyboolean否true通过 Scrapier 的住宅代理池路由,默认开启。保持原样即可true
raw_databoolean否false在 raw_responses 下返回 Yandex 的上游原始数据,而不是格式化后的条目true

每次调用一个搜索词:要搜索十个词,就调用十次,并用 cursor 为每个词翻页。布尔值是字符串 true 或 false。

Yandex 搜索爬虫 API 的分页

Yandex 搜索爬虫 API 分页返回结果。将 data.next_cursor 作为 cursor 传回即可获取下一页;当它为 null 时表示没有更多页。每次成功调用,无论是第一页还是之后的页,都消耗 10 积分。

访问

无需 Yandex 登录即可访问

Yandex 搜索爬虫 API 不需要 Yandex 账号、登录或会话 Cookie。你在 X-API-Key 请求头中发送 Scrapier 密钥,即可得到 JSON。它只读取公开数据:任何访客无需登录就能看到的内容。

性能

速度、成本和并发

指标数值来源
成功调用的成本10 积分Scrapier 目录
失败调用的成本0 积分任何非 2xx 响应
每个密钥的并行请求数无限制所有套餐均无速率限制
建议的客户端超时210 秒Scrapier 文档,适用于每个端点

Yandex 搜索爬虫 API 的延迟

Scrapier 未公布该端点的延迟或成功率数据。每次调用都在调用时读取 Yandex,因此响应时间取决于 Yandex 和结果的大小。请按文档对所有端点的建议,将客户端超时设为 210 秒。

限制

端点的限制

Yandex 搜索爬虫 API 的坦率限制。

  • 仅限公开数据。
  • 失败的调用,例如结果页缺失或不可用,会返回非 2xx 状态,并消耗 0 积分。
  • 数据在调用时实时读取。
  • 没有速率限制,因此需要多少并行请求,就发多少。
  • 较大的结果分页返回;把 data.next_cursor 作为 cursor 传回。
  • Yandex 不显示的字段不会返回。
对比

Scrapier 与官方 Yandex API 对比

如果你已按自己的合同和条款使用某款 Yandex 搜索产品,那它可能更合适;Scrapier 适合希望用一个密钥、一种 JSON 结构覆盖多个平台的团队。

功能Scrapier 结果页爬虫官方 Yandex API
所需权限一个 Scrapier API 密钥需要单独的 Yandex 账号和 API 配置
哪些数据任意查询的自然搜索结果,与 Yandex 显示的一致取决于你使用的 Yandex 搜索产品
返回的字段每条结果 8 个字段:position、type、URL、title、display URL 和 snippet因产品而异
设置注册,复制密钥,发送请求需先完成账号和产品设置
成本每页 10 积分,每 1,000 页低至 $1.20由 Yandex 自己的定价决定
错误

错误与重试处理

状态含义是否计费解决办法
200在 data.results 中返回的一页结果数据是—
400输入有误或缺失否检查 queries:每次调用一个值
401缺少 X-API-Key 请求头否添加该请求头
402积分用完(响应体含 balance)否充值;重试无济于事
403API 密钥无效或已撤销否在控制台中检查密钥
429被限流否等待 Retry-After 秒后重试
5xx上游故障或超时否退避重试;把客户端超时设为 210 s

来自错误参考。任何非 2xx 响应消耗 0 积分。

Yandex 搜索爬虫 API 的重试逻辑

retry.py
import time, requests

def get_search(value, key, tries=5):
    for attempt in range(tries):
        r = requests.get(
            "https://api.scrapier.io/api/v2/yandex-search/",
            headers={"X-API-Key": key},
            params={"queries": value},
            timeout=210,
        )
        if r.status_code == 429:
            time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
        elif r.status_code >= 500:
            time.sleep(2 ** attempt)
        else:
            r.raise_for_status()
            return r.json()
    raise RuntimeError("gave up after retries")
价格

价格与速率限制

套餐月费包含的结果页数每 1,000 次成本
Hobby$2915,000$1.93
Pro$7950,000$1.58
Scale$299250,000$1.20

查看所有套餐 →

Yandex 搜索爬虫 API 的计费规则

Yandex Search Scraper API 按每个成功获取的结果页收取 10 积分。失败的调用(即任何非 2xx 状态)消耗 0 积分。所有套餐都没有速率限制。付费前可以先用免费额度试用。

批量

批量查询与 CSV

queries 每次调用只接受一个值。对于列表,循环并行调用(没有速率限制),然后把每一行展平为一行 CSV。

bulk.py
import csv, requests
from concurrent.futures import ThreadPoolExecutor

values = ["python tutorial"]  # your list

def fetch(value):
    r = requests.get(
        "https://api.scrapier.io/api/v2/yandex-search/",
        headers={"X-API-Key": "YOUR_API_KEY"},
        params={"queries": value},
        timeout=210,
    )
    r.raise_for_status()
    out = r.json()["data"]["results"]
    return out if isinstance(out, list) else [out]

# no rate limits: use as many workers as you need
with ThreadPoolExecutor(max_workers=3) as pool:
    rows = [row for part in pool.map(fetch, values) for row in part]

cols = ["position", "type", "url", "title", "display_url", "snippet"]
with open("out.csv", "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=cols, extrasaction="ignore")
    w.writeheader()
    w.writerows(rows)

从 Yandex 搜索爬虫 API 导出 CSV

out.csv目录示例 · 1 行
position,type,url,title,display_url,snippet
1,organic,https://docs.python.org/3/tutorial/index.html,The Python Tutorial — Python 3.14.7 documentation,Docs.Python.org,This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.
智能体

通过 MCP 供 AI 智能体访问

Yandex 搜索爬虫 API 的 MCP

AI 智能体可通过 Scrapier MCP 服务器 https://mcp.scrapier.io/mcp 使用同一个端点。在 Claude Code 中一条命令即可注册:claude mcp add -t http scrapier https://mcp.scrapier.io/mcp --header "X-API-Key: YOUR_API_KEY"。智能体用 search_endpoints 找到该端点,再用 run_scrape 和端点 ID yandex-search 调用。它接收相同的 queries 输入,每页结果同样消耗 10 积分。各客户端的设置见 Yandex 搜索爬虫 MCP 页面。

集成

按角色划分的集成路径

无代码

n8n 和 Make

  1. 添加一个 HTTP Request 步骤
  2. 带上你的 X-API-Key 请求头,对该端点发送 GET
  3. 把 data.results 字段映射到你的列
开发者

循环并翻页

for value in values: rows += get(value) while cur := page["data"]["next_cursor"]: page = get(cursor=cur)
AI 智能体

智能体中的 MCP 工具

在 Claude、Cursor 或 Windsurf 中,用端点 yandex-search 调用 run_scrape。设置方法见 MCP 页面。

分析师

CSV 和展平的 JSON

把每一行展平为一行 CSV,每个字段一列,可直接用于 Sheets、Excel 或 BI 工具。

常见问题

常见问题

有 Yandex 结果页 API 吗?

有。Scrapier 的 Yandex 搜索爬虫 API 只需一次 GET 请求和一个 X-API-Key 请求头,就能以 JSON 返回任何公开的结果页。无需 Yandex 应用或登录。

如何从 Python 调用?

对 <code>https://api.scrapier.io/api/v2/yandex-search/</code> 使用 <code>requests.get</code>,带上 <code>params={'queries': 'python tutorial'}</code> 和 <code>headers={"X-API-Key": KEY}</code>。读取 <code>r.json()["data"]["results"]</code>。

调用失败时会怎样?

任何非 200 响应都免费。对 429 和 5xx 请退避重试;API 已经会重试上游故障。

多少钱?

每次成功调用 10 积分,在 Pro 套餐上每 1,000 页结果约 $1.58。失败的调用免费。

有 OpenAPI 规范吗?

有。获取它无需密钥,并且涵盖每个 Scrapier 端点。

一次请求即可获取公开的 Yandex 结果页,输出为类型化 JSON

每页结果 10 积分 · 失败的调用免费