POST

接口健康状态

24h 健康值
93%
24h 平均耗时
12.86 s
  • 健康 / 正常
  • 可用
  • 少量可用
  • 基本不可用
健康

24 小时趋势

30 天趋势

关键词搜索:返回列表,默认 10 条、单次最多 50 条;主要字段 id、url、title、text、author_name、author_username。

请求发到 POST https://api.everyinfra.com/api/v1/social,platform 填 youtube,action 填 search。 单价 $0.78 / 千次(每次 $0.000778),失败和空结果都不收费。 同步返回;慢任务可在请求体加 "mode": "async",先拿 job_id 再轮询。

AI 提示词

#
请帮我用 EveryInfra 的「YouTube 关键词搜索」接口(youtube/search)写一个数据采集脚本。

接口约定:
- 请求:POST https://api.everyinfra.com/api/v1/social,请求头 Authorization: Bearer <API Key>;Key 从环境变量 EVERYINFRA_API_KEY 读取,不要写进代码。
- 请求体里 platform 填 youtube,action 填 search,参数放在 params 里。
- 必填参数:
  - keyword:YouTube 视频搜索词,不是频道 handle 或视频 ID。
- 可选参数:
  - sort:视频搜索排序:relevance 相关性、newest 最新发布、most_viewed 播放量、top_rated 评分。(可选值:most_viewed / newest / relevance / top_rated)
  - limit:这次调用最多返回的条数,整数,1–50;不传按默认值,实际返回可能少于这个数。超过上限会在扣费前返回 422。(默认 10)
- 返回一组记录,每条记录的主要字段:id、url、title、text、author_name、author_username、author_id、author_url、like_count、comment_count、view_count、duration(时长);一共 24 个字段,完整列表见 https://api.everyinfra.com/api/v1/social/catalog?platform=youtube。
- 示例请求体:
{
  "platform": "youtube",
  "action": "search",
  "params": {
    "keyword": "urban gardening tutorial"
  }
}
- 计费:$0.78 / 千次;失败和空结果不扣费。
- 一次要采几十上百个时,在请求体加 "mode": "async":先拿到 job_id,再轮询 GET https://api.everyinfra.com/api/v1/jobs/{job_id} 取结果。
- 返回 422 时,按错误信息里的候选参数和允许值修正;返回 429 或 503 时,按 Retry-After 等待后重试。

写代码前,先问清楚我要采哪些对象、一共多少个、需要哪些字段、结果存成什么格式,再把方案和大概花费讲给我确认。

请求参数

#
参数名位置类型必填默认值说明
Authorizationheaderstring是-Bearer 加你的 API Key。在控制台创建;不要放进网址或代码仓库。
platformbodystring是youtube平台标识,固定值。
actionbodystring是search能力标识,固定值。
keywordbody.paramsstring是-YouTube 视频搜索词,不是频道 handle 或视频 ID。
sortbody.paramsstring (enum)否-视频搜索排序:relevance 相关性、newest 最新发布、most_viewed 播放量、top_rated 评分。允许值most_viewednewestrelevancetop_rated
limitbody.paramsinteger (1–50)否10这次调用最多返回的条数,整数,1–50;不传按默认值,实际返回可能少于这个数。超过上限会在扣费前返回 422。

代码示例

#
bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "youtube",
  "action": "search",
  "params": {
    "keyword": "urban gardening tutorial"
  }
}'

OpenAPI 定义 (JSON)示例从环境变量 EVERYINFRA_API_KEY 读取 Key,复制出去的代码不含你的 Key。

这里检索视频主题;频道资料、字幕和评论使用各自目标。

响应示例

#
2026年9月26日 16:56(北京时间)用上方代码示例的参数真实调用所得。results 与 count 是那次的真实返回,已隐去名字、账号、头像、主页链接、联系方式等个人信息,列表只保留前 2 条;id、billing、quota 每次调用都不同,只给结构。
json
{  "id": "req_…",  "platform": "youtube",  "action": "search",  "results": [    {      "id": "SgqP8fgnzgI",      "url": "https://www.youtube.com/watch?v=SgqP8fgnzgI",      "title": "Fall Garden Seed Starting: Onions, Tomatoes, Collards & More 🌱 (North Texas Guide)",      "text": "It's time to start thinking about the fall garden here in North Texas. Starting seeds indoors now gives you a head start on cooler-weather crops and extends your growing season well into autumn.\n\nIn this video, I'm walking you through everything I'm starting right now—from bunchi…",      "author_name": "•••",      "author_username": "•••",      "author_id": "•••",      "author_url": "https://www.youtube.com/•••",      "like_count": 867,      "comment_count": 194,      "view_count": 7618,      "duration": "00:42:07",      "posted_at": "2026-08-17T05:39:08+00:00",      "platform": "youtube"    },    {      "id": "DZuMFAlLrmE",      "url": "https://www.youtube.com/watch?v=DZuMFAlLrmE",      "title": "How to Fill a Raised Garden Bed for FREE!",      "text": "Instead of buying expensive soil, I filled this garden bed organically with stuff I had lying around!\n\nHere’s the free recipe:\n🟫 Cardboard — weed blocker + worm buffet\n🌿 Old sticks — drainage + spongey structure (the older, the better)\n🍂 Dried leaves — quick compost, full of micr…",      "author_name": "•••",      "author_username": "•••",      "author_id": "•••",      "author_url": "https://www.youtube.com/•••",      "like_count": 86115,      "comment_count": 1232,      "view_count": 2811422,      "duration": "00:00:58",      "posted_at": "2025-06-21T21:47:59+00:00",      "platform": "youtube"    }  ],  "count": 10,  "billing": {    "charged": …,    "charged_usd": …,    "balance_after_usd": …,    …  },  "quota": { … }}

返回字段

#

业务数据在 results 里;下表是每条记录可能包含的字段,平台没有提供的值不会被编造。

字段含义
id该记录在原平台上的唯一标识。仅在同一平台内唯一,跨平台可能重复。
url该记录在原平台上的可访问链接。
title标题。平台无标题概念时(如纯文本帖)为 null。
text正文内容,已去除 HTML 标签,全文返回、不截断(个别平台的列表结果本身只有摘要,以该平台的字段说明为准)。
author_name作者昵称(显示名)。
author_username作者用户名(@handle),通常可用于拼 URL。
author_id作者在原平台的唯一 ID。
author_url作者在原平台的主页链接。
like_count点赞数。null 表示该平台或该接口不公开此数据,不等于 0。
comment_count评论数。null 表示不公开,不等于 0。
view_count浏览/播放数。null 表示不公开,不等于 0。
duration时长。
posted_at发布时间,ISO 8601 格式、UTC 时区(如 2026-08-07T12:34:56+00:00)。平台只给非标准字符串时原样透传,解析前建议做容错。null 表示平台未公开。
thumbnail_url缩略图链接,分辨率低于 image_url。
hashtags正文里的话题标签数组,按出现顺序;没有时不出现这个字段。
is_comments_disabled是否关闭评论。
is_members_only是否会员专享视频。
is_paid_partnership是否含付费推广。
author_follower_count作者粉丝数。null 表示不公开。
author_video_count频道视频总数。
author_view_count频道总播放量。
author_created_at保留平台原语义
description_links视频简介里的链接:text、url。
search_rank在这次搜索结果里的名次,从 1 开始。
platform数据来源平台标识,与请求里的 platform 一致(如 xiaohongshu、tiktok)。

错误与计费

#
401
缺少 Key 或 Key 无效。
402
余额不足,先充值。
422
参数名或取值不对,按错误信息给的候选改;不扣费。
429
超过每分钟请求上限,按 Retry-After 等待后再试。
503
暂时无法完成,预扣的费用退回;结果未知时先核对,不要直接重发。
200 空结果
没有数据,不扣费。

错误码

自有访问统计常开;Google Analytics 仅在你点「同意分析」后启用。 隐私政策