公开接口契约 · /v1

Public API contract · /v1

猫抓学术数据接口

ScrapingCat Scholar API

ScrapingCat Scholar API

谷歌学术数据服务

谷歌学术数据服务,提供与 SerpApi 兼容的 JSON 接口:文献搜索、作者档案、 引用导出、学者搜索、论文精确解析、作者档案摘要库,以及持久化批量任务。

A Google Scholar data service with a SerpApi-shaped JSON contract: organic search, author profiles, citation exports, profile search, deterministic paper resolution, profile summaries, and durable bulk batches.

基础地址Base URL https://scrapingcat.boyinzhiheng.com

身份验证Authentication

所有 /v1 路由都要求在 X-API-Key 请求头中携带 API 密钥。 不支持把密钥放在查询字符串里:携带 api_key 查询参数的请求会直接返回 400,无论其取值。

Every /v1 route requires an API key sent in the X-API-Key request header. Keys in the query string are rejected: a request carrying an api_key query parameter fails with 400 regardless of its value.

curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/search?engine=google_scholar&q=deep+learning"

通用查询规则:参数不允许重复,未知参数会被拒绝; 如提供 output,其值必须为 json

General query rules: keys may not be duplicated, unknown keys are rejected, and output (when supplied) must be json.

错误与状态码Errors & status codes

所有错误响应使用同一结构。request_id 对每个请求唯一——反馈问题时请附上它。

Every error response uses one fixed shape. request_id is unique per request — include it when reporting a problem.

{
  "error": {
    "code": "rate_limited",
    "message": "Request rate limit exceeded",
    "retryable": true
  },
  "request_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
状态码错误码可重试含义
400invalid_parameters请求参数校验失败
401unauthorizedAPI 密钥缺失或无效
404author_not_foundsearch_not_foundcitation_not_foundprofiles_not_foundroute_not_found请求的对象不存在
409conflict与当前状态冲突(如 Idempotency-Key 重复使用但内容不同)
410expired资源已超过保留期
413request_too_large上传或请求体超过大小限制
429rate_limitedip_budget_exhausted容量暂时不足;如返回 Retry-After 请遵循其提示
502upstream_errorscholar_fetch_failedsoft_blockedparse_errorGoogle Scholar 未返回可用响应
503service_unavailableprovider_unavailableglobal_circuit_open服务或上游容量暂时不可用
507insufficient_storage结果存储容量不足
StatusCodeRetryableMeaning
400invalid_parametersnoRequest parameters failed validation
401unauthorizednoInvalid or missing API key
404author_not_found, search_not_found, citation_not_found, profiles_not_found, route_not_found, …noThe requested entity does not exist
409conflictnoRequest conflicts with current state (e.g. Idempotency-Key reuse with different content)
410expirednoResource is past its retention window
413request_too_largenoUpload or body exceeds the size limit
429rate_limited, ip_budget_exhaustedyesCapacity is temporarily unavailable; honor Retry-After when present
502upstream_error, scholar_fetch_failed, soft_blocked, parse_erroryesGoogle Scholar did not return a usable response
503service_unavailable, provider_unavailable, global_circuit_openyesService or upstream capacity is temporarily unavailable
507insufficient_storageyesResult storage capacity is unavailable

一个搜索接口,六种引擎。engine 参数选择目标,并决定其余参数的取值范围。

One search endpoint, six engines. The engine parameter selects the target and determines which other parameters are valid.

engine=google and engine=baidu — 网页搜索 — web search

这两个引擎仅供内部低频使用。均要求 q(1–2048 字符),接受 num 1–20(默认 10)、start ≥ 0(默认 0)、 no_cache=true|false(默认 false)以及 output=json。 Google 另接受 hl(默认 en)与可选的两位 gl; Baidu 拒绝这两个参数。Baidu 结果保留跳转链接,不做重定向解析。

These engines are for internal low-volume use. Both require q (1–2048 characters), accept num from 1–20 (default 10), start at 0 or greater (default 0), no_cache=true|false (default false), and output=json. Google also accepts hl (default en) and an optional two-letter gl; Baidu rejects both. Baidu results preserve redirect links and perform no Baidu redirect resolution.

不执行 JS/浏览器渲染。目标未启用时,这些调用可能返回 503 feature_disabled

No JS/browser rendering is performed. These calls may return 503 feature_disabled when their target is not enabled.

engine=google_scholar — 文献搜索 — organic search

至少提供 qcitescluster 之一。 clusterq/cites 互斥。

Requires at least one of q, cites, or cluster. cluster is exclusive with q and cites.

参数类型默认说明
qstring检索词,最长 2048 字符
citesdigits按某结果的引用簇检索“被引用”文献
clusterdigits同一聚簇结果的全部版本
as_ylo / as_yhiint年份范围过滤
scisbd0 | 1 | 20按日期排序(1:含摘要,2:全部)
hlstringen界面语言
lrstring语言限制,如 lang_en|lang_fr
startint ≥ 00分页偏移
num1–2010每页结果数
as_sdtstring0,5检索类型 / 专利与引用控制
safeactive | off安全搜索开关
filter0 | 11相似/省略结果过滤
as_vis0 | 10结果中排除引用条目
as_rr0 | 10仅综述文章
ParameterTypeDefaultNotes
qstringSearch query, up to 2048 chars
citesdigitsCited-by search for a result's citation cluster
clusterdigitsAll versions of one clustered result
as_ylo / as_yhiintYear range filter
scisbd0 | 1 | 20Sort by date (1: abstracts, 2: everything)
hlstringenInterface language
lrstringLanguage restriction, e.g. lang_en|lang_fr
startint ≥ 00Result offset for pagination
num1–2010Results per page
as_sdtstring0,5Search type / patents-and-citations control
safeactive | offSafe-search toggle
filter0 | 11Similar/omitted-result filtering
as_vis0 | 10Exclude citations from results
as_rr0 | 10Review articles only
curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/search?engine=google_scholar&q=attention+is+all+you+need&num=10"

响应结构与 SerpApi 的 Google Scholar 形状一致: search_metadatasearch_parameterssearch_informationorganic_results[](含 result_idtitlelinkpublication_infoinline_links.cited_by 等),有更多页时附 pagination

The response mirrors the SerpApi Google Scholar shape: search_metadata, search_parameters, search_information, organic_results[] (with result_id, title, link, publication_info, inline_links.cited_by, …) and pagination when more pages exist.

engine=google_scholar_author — 作者主页 — author profile

参数类型默认说明
author_idstring必填Scholar 作者标识,如 qc6CJjYAAAAJ
hlstringen界面语言
view_opview_citation | list_colleagues切换到单篇引用视图或合作者列表
citation_idstringview_op=view_citation 配合使用;必须属于 author_id
sortcitations | title | pubdatecitations文章排序方式
startint ≥ 00文章偏移
num1–10020每页文章数
ParameterTypeDefaultNotes
author_idstringrequiredThe Scholar author identifier, e.g. qc6CJjYAAAAJ
hlstringenInterface language
view_opview_citation | list_colleaguesSwitch to a single citation view or the co-author list
citation_idstringRequired with view_op=view_citation; must belong to author_id
sortcitations | title | pubdatecitationsArticle ordering
startint ≥ 00Article offset
num1–10020Articles per page
curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/search?engine=google_scholar_author&author_id=qc6CJjYAAAAJ&num=100"

需要一次取回全部著作时,可使用同语义的 /author 路由并传 all_pages=true(自动翻页直到收齐)。

To collect every publication in one call, use the equivalent /author route with all_pages=true (follows pagination until complete).

engine=google_scholar_cite — 引用导出 — citation export

q 为文献搜索响应中的 result_id。返回各引用格式 (MLA、APA、Chicago、Harvard、Vancouver)与导出链接(BibTeX、EndNote、RefMan、RefWorks)。

q is a result_id taken from an organic search response. Returns the formatted citation styles (MLA, APA, Chicago, Harvard, Vancouver) and export links (BibTeX, EndNote, RefMan, RefWorks).

curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/search?engine=google_scholar_cite&q=KlAl5vgvd-8J"

engine=google_scholar_profiles — 学者搜索 — profile search

通过 mauthors 按姓名搜索学者档案。分页使用不透明的续页令牌: 从上一次响应中取 after_authorbefore_author(二者互斥)传入。 该接口为尽力而为,高负载下可能返回可重试的上游错误。

Searches author profiles by name via mauthors. Pagination uses opaque continuation tokens: pass either after_author or before_author (mutually exclusive) from a previous response. This surface is best-effort and may return a retryable upstream error under load.

curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/search?engine=google_scholar_profiles&mauthors=Geoffrey+Hinton"

GET /v1/profiles/{author_id}

作者档案摘要:任意 Google Scholar 作者均可查询,返回一条扁平化摘要—— 姓名、机构、邮箱域名、研究方向、引用指标(总量与近五年)、高被引论文前 10 条、合作者等。 服务端维护一个持续增长的摘要缓存,仅用于加速与节省上游流量,不限定可查询的作者范围: 缓存记录在新鲜期内(默认 30 天)时即时返回且不访问上游;记录缺失或过期时, 服务会实时抓取作者首页、重建摘要、写回缓存后返回。实时刷新失败而旧记录存在时, 返回旧记录并标记 profile_cache.stale=true

Author profile summary: look up any Google Scholar author and get one flattened record — name, affiliation, email domain, interests, citation metrics (total and recent), top-10 papers, and co-authors. The server keeps a growing summary cache purely for speed and upstream-cost savings; it does not limit which authors can be queried. A cached record within the freshness window (default 30 days) returns instantly with no upstream traffic; a missing or stale record triggers one live first-page fetch, is re-summarized, written back, and returned. If the live refresh fails while a stale record exists, the stale record is returned with profile_cache.stale=true.

参数类型说明
author_id路径参数Scholar 作者标识,如 JicYPdAAAAAJ
ParameterTypeNotes
author_idpathThe Scholar author identifier, e.g. JicYPdAAAAAJ
curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/profiles/JicYPdAAAAAJ"
{
  "author_id": "JicYPdAAAAAJ",
  "name": "Geoffrey Hinton",
  "candidate_name": "G Hinton",
  "affiliation": "Emeritus Prof. Computer Science, University of Toronto",
  "email_domain": "cs.toronto.edu",
  "interests": [{"title": "machine learning", "link": "..."}],
  "total_citations": 1064313,
  "h_index": 129, "i10_index": 383,
  "citations_recent": 601672, "h_index_recent": 67, "i10_index_recent": 205,
  "top10_paper_titles": [{"title": "...", "year": "2012", "citations": 198341}],
  "coauthors": [{"name": "...", "author_id": "...", "affiliation": "..."}],
  "fetched_at": "2026-07-17T07:32:16+00:00",
  "profile_url": "https://scholar.google.com/citations?user=JicYPdAAAAAJ",
  "profile_cache": {"hit": true, "stale": false, "fetched_at": "..."}
}
profile_cache 说明本次响应的来源: hit=true, stale=false 表示命中新鲜缓存记录;hit=false 表示刚完成实时抓取; hit=true, stale=true 表示实时刷新失败、返回的是过期记录(附 refresh_error 错误码)。需要完整著作列表时请配合 /authorall_pages=true)使用;档案专用密钥对这两类接口均可用。
profile_cache reports where the response came from: hit=true, stale=false is a fresh cache hit; hit=false means a live refresh just ran; hit=true, stale=true means the refresh failed and a stale record was served (with a refresh_error code). For the complete publication list, pair this with /author (all_pages=true); profile-scoped keys work on both surfaces.

GET /v1/fetch

抓取单个匿名公共 HTTP(S) GET 资源,仅供内部低频使用。必填 url,可选 formathtmlmetabothtextmarkdown 之一;默认 markdown)、max_chars (1–1,000,000;默认 100,000)、start_index(默认 0)、 no_cache(默认 false)与 output=json

Fetches one anonymous public HTTP(S) GET resource for internal low-volume use. Required url is accompanied by format (one of html, meta, both, text, or markdown; default markdown), max_chars (1–1,000,000; default 100,000), start_index (default 0), no_cache (default false), and output=json.

仅接受公共端口 80 与 443。每一跳重定向都会重新校验,最多 10 次。接受的 MIME 类型仅为 text/htmlapplication/xhtml+xmltext/plain; 响应体上限 5,000,000 字节,请求超时 35 秒。目标返回普通 4xx/5xx 时 API 调用本身仍视为成功, 体现在 page.status_code 中。

Only public ports 80 and 443 are accepted. Redirects are revalidated at every hop, with at most 10 redirects. Accepted MIME types are exactly text/html, application/xhtml+xml, and text/plain; the body cap is 5,000,000 bytes and the request timeout is 35 seconds. Ordinary target 4xx/5xx responses remain successful API responses and are represented in page.status_code.

不支持 JS/浏览器渲染、登录、会话、自定义请求头、Cookie、POST、请求体、批量或爬取。 响应使用标准的 fetch_metadatafetch_parameterspage 对象;错误使用标准 error + request_id 结构,目标关闭时返回 503 feature_disabled

No JS/browser rendering, no login, no session, no caller headers, no cookies, no POST, no body, no batch, and no crawl are supported. The response uses the standard fetch_metadata, fetch_parameters, and page objects; errors use the standard error plus request_id shape, including 503 feature_disabled when the target is off.

GET /v1/papers/resolve

面向 Google Scholar 的确定性论文解析。提供恰好一个选择器:

Deterministic paper lookup against Google Scholar. Supply exactly one selector:

选择器示例
doi10.1038/nature14539
pmid26017442
arxiv_id1706.03762
titleDeep learning
SelectorExample
doi10.1038/nature14539
pmid26017442
arxiv_id1706.03762
titleDeep learning
curl -H "X-API-Key: $SCAT_API_KEY" \
  "https://scrapingcat.boyinzhiheng.com/v1/papers/resolve?doi=10.1038/nature14539"

响应给出显式的 match_status——exactprobableambiguousnot_found——以及匹配到的结果(标识符、标题、链接、引用数) 与参与比对的候选,便于调用方套用自己的接受策略。

The response reports an explicit match_statusexact, probable, ambiguous, or not_found — together with the matched result (identifiers, title, link, citation counts) and the candidates that were considered, so callers can apply their own acceptance policy.

持久化批量任务Durable batches

批量任务异步处理成千上万个作者或论文,状态持久化:任务元数据、逐条进度、重试、 暂停/恢复、崩溃安全的结果归档都能在服务重启后存活。提交输入、轮询状态, 然后下载压缩的 NDJSON 归档——每个规范化输入对应一条终态记录。

Batches process thousands of authors or papers asynchronously with durable state: batch metadata, per-item progress, retries, pause/resume, and crash-safe result archives all survive service restarts. Submit inputs, poll status, then download a compressed NDJSON archive of one terminal record per canonical input.

批量任务接口Batch endpoints

方法路径用途
POST/v1/batches/authors创建内联作者批量任务(JSON 请求体)
POST/v1/batches/authors/upload流式上传 TXT(每行一个 author_id)或 JSONL
POST/v1/batches/papers创建内联论文批量任务(JSON 请求体)
GET/v1/batches/{batch_id}汇总状态、计数与时间
GET/v1/batches/{batch_id}/items游标分页的条目视图;可选 state/error 过滤
POST/v1/batches/{batch_id}/pause请求持久化暂停
POST/v1/batches/{batch_id}/resume恢复已暂停的任务
GET/v1/batches/{batch_id}/results.ndjson.gz下载终态结果归档(gzip NDJSON)
MethodPathPurpose
POST/v1/batches/authorsCreate an inline author batch (JSON body)
POST/v1/batches/authors/uploadStream a TXT (one author_id per line) or JSONL upload
POST/v1/batches/papersCreate an inline paper batch (JSON body)
GET/v1/batches/{batch_id}Aggregate status, counters, and timing
GET/v1/batches/{batch_id}/itemsCursor-paginated item projection; optional state/error filters
POST/v1/batches/{batch_id}/pauseRequest a durable pause
POST/v1/batches/{batch_id}/resumeResume a paused batch
GET/v1/batches/{batch_id}/results.ndjson.gzDownload the terminal result archive (gzip NDJSON)
curl -X POST -H "X-API-Key: $SCAT_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: my-batch-2026-07-17" \
  -d '{"items":[{"author_id":"qc6CJjYAAAAJ"},{"author_id":"JicYPdAAAAAJ"}],"options":{"hl":"en"}}' \
  "https://scrapingcat.boyinzhiheng.com/v1/batches/authors"
curl -H "X-API-Key: $SCAT_API_KEY" \
  -o results.ndjson.gz \
  "https://scrapingcat.boyinzhiheng.com/v1/batches/b_01J.../results.ndjson.gz"

归档中每一行是一条 JSON 记录:条目的原始 input_index、规范化输入、终态,以及完整结果文档或固定的错误分类。

Each archive line is one JSON record with the item's original input_index, canonical input, terminal state, and either the full result document or a fixed error classification.

批量与条目状态Batch & item states

ingesting → queued → running → completed | completed_with_errors | failed
                       │
                       └→ pausing → paused → queued  (on resume)

条目状态:pendingrunningretry_waitsucceedednot_foundfailed。对象不存在 (如未知的 author_id)终态为 not_found,而非 failed

Item states: pending, running, retry_wait, succeeded, not_found, failed. A missing entity (e.g. an unknown author_id) terminates as not_found, not failed.

限额与保留期Limits & retention

限额取值
内联批量大小(作者或论文)1 – 10,000 条
作者文件上传最多 500,000 条 / 32 MiB
条目分页大小1 – 1,000
搜索分页大小(num1 – 20
作者分页大小(num1 – 100
结果归档保留期任务到达终态后 7 天
批量元数据保留期30 天
LimitValue
Inline batch size (authors or papers)1 – 10,000 items
Author uploadup to 500,000 records / 32 MiB
Items page size1 – 1,000
Search page size (num)1 – 20
Author page size (num)1 – 100
Result archive retention7 days after the batch reaches a terminal state
Batch metadata retention30 days
超出当前上游容量的请求会返回可重试的 429/503 错误,而不是静默排队——请按 Retry-After 提示退避后重试。
Requests beyond current upstream capacity return retryable 429/503 errors rather than queueing silently — back off and retry with the Retry-After hint when present.

健康与就绪检查Health & readiness

接口鉴权用途
GET /health服务身份与存活:{"service":"scrapingcat", "version":..., "status":"ok"}
GET /ready就绪检查:存储写探针、磁盘余量与调度器健康;就绪返回 200,否则 503。绝不访问 Google。
EndpointAuthPurpose
GET /healthnoneService identity and liveness: {"service":"scrapingcat", "version":..., "status":"ok"}
GET /readynoneReadiness: storage write probes, disk admission, and scheduler health; 200 when ready, 503 otherwise. Never contacts Google.