接口说明

YouTube Search API 按关键词搜索 YouTube 内容,返回搜索结果及对应信息。

使用 Pangolinfo API Key 调用,返回结构化 JSON 数据。

请求URL

POST https://scrapeapi.pangolinfo.com/api/v1/social/youtube-search

请求头

参数名参数值类型说明
Content-Typeapplication/jsonstring数据格式
AuthorizationBearer xxxstring认证凭证

采集最长约75秒,客户端超时建议设为90秒。

请求参数

参数必填类型说明
targetYesstring搜索关键词
optionsNoobject仅处理下列开放参数;未列出的字段忽略,内部参数不可覆盖。

options 参数说明

参数必填类型说明
maxPagesNointeger本次请求翻几页,默认 1,最大 5,按实际返回条数计费,更多数据用返回的游标续取
默认值: 1
最小值: 1
最大值: 5
typeNostring只搜某类结果; 不传为综合结果 (以视频为主, 夹带少量频道);可选值:video / channel
可用值: [“video”, “channel”]
paramsNostring搜索 filter (base64 protobuf), 如 ‘EgIQAQ%3D%3D’ 仅视频; 给了以它为准, 忽略 type
cursorNostring | null续页: 上次输出的 pagination.cursor

仅处理本页列出的请求参数,其他字段忽略。分页游标原样传回,不编码、解码或转换格式。

每次默认1页,最多5页;页数必须为正整数,超过5按5处理。

响应值

返回值类型说明
codeinteger状态码,0 表示成功
messagestring响应信息,成功时为 ok
pointCostnumber本次请求实际消耗的积点
dataobject返回数据,结构见下表
metaobject请求标识及耗时(毫秒)
billingobject计费条数、单价及规则版本

返回参数 data 说明

返回值类型说明
videosobject[]视频结果; options.type=channel 时为空
channelsobject[]频道结果 (混在视频结果里的, 或 options.type=channel)
countnumbervideos + channels 条数
paginationobjectPagination

data.videos[] 字段说明

返回值类型说明
urlstring | null视频链接
titlestring | null标题
durationnumber | null时长 (秒); 直播为 null
videoIdstring视频 id
isShortboolean是否 Shorts
descriptionSnippetstring | null简介片段
durationTextstring | null时长文案; 直播为 null
viewsnumber | null播放数 (直播为观看人数)
shortViewCountTextstring | null播放数短文案, 如 58M views
publishedTimeTextstring | null发布时间文案; 直播为 null
thumbnailsobject[]缩略图各尺寸
coverstring | null最大缩略图
badgesstring[]徽章, 如 LIVE / 4K / CC
posterobject作者

data.videos[].thumbnails[] 字段说明

返回值类型说明
urlstringUrl
widthnumber宽
heightnumber高

data.videos[].poster 字段说明

返回值类型说明
nicknamestring | null频道名
channelIdstring | null频道 id
handlestring | null@handle
avatarstring | null频道头像
profileUrlstring | null频道链接
badgesstring[]频道徽章, 如 Verified / Official Artist Channel

data.channels[] 字段说明

返回值类型说明
channelIdstring频道 id
titlestring | null频道名
handlestring | null@handle
urlstring频道链接
thumbnailsobject[]头像各尺寸
descriptionSnippetstring | null简介片段
subscriberCountTextstring | null订阅数文案
subscriberCountnumber | null订阅数
videoCountTextstring | null视频数文案; 搜索结果通常不给
videoCountnumber | null视频数
badgesstring[]频道徽章

data.channels[].thumbnails[] 字段说明

返回值类型说明
urlstringUrl
widthnumber宽
heightnumber高

data.pagination 字段说明

返回值类型说明
cursorstring | null下一页游标, 传回 options.cursor 续取
hasMoreboolean是否还有更多

请求示例

curl --request POST \
  --url https://scrapeapi.pangolinfo.com/api/v1/social/youtube-search \
  --header 'Authorization: Bearer YOUR_PANGOLINFO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "target": "lofi hip hop"
}'

返回示例

下例截取实际响应中的首条列表记录,长文本与链接作了缩写;pointCost 为该次完整响应的实际费用。完整字段结构可在在线调试页查看。

{
  "code": 0,
  "message": "ok",
  "pointCost": 34.4,
  "data": {
    "videos": [
      {
        "url": "https://www.youtube.com/watch?v=rFZHOHl-L8A",
        "title": "lofi hip hop radio 📚 beats to relax/study to",
        "duration": null,
        "videoId": "rFZHOHl-L8A",
        "isShort": false,
        "descriptionSnippet": "Spooky season is officially upon us 2026 Halloween playlist available now: https://lnk.to/halloween-lofi02 | Listen on Spotify, ...",
        "durationText": null,
        "views": 10197,
        "shortViewCountText": null,
        "publishedTimeText": null,
        "thumbnails": [
          {
            "url": "https://i.ytimg.com/vi/rFZHOHl-L8A/hq720.jpg?v=6ad62bed&sqp=-oaymwEgCOgCEMoBSFXyq4qpAxIIARUAAIhCGAFwAcABBrgC9xg=&rs=AOn4CLAvQ4rf_sYMdux1p1ObxxVXesAy0w",
            "width": 360,
            "height": 202
          }
        ],
        "cover": "https://i.ytimg.com/vi/rFZHOHl-L8A/hq720.jpg?v=6ad62bed&sqp=-oaymwEgCNAFEJQDSFXyq4qpAxIIARUAAIhCGAFwAcABBrgC9xg=&rs=AOn4CLAWuRauLyqoHfmvuMYDmbjmeCREpw",
        "badges": [
          "LIVE"
        ],
        "poster": {
          "nickname": "Lofi Girl",
          "channelId": "UCSJ4gkVC6NrvII8umztf0Ow",
          "handle": null,
          "avatar": "https://yt3.ggpht.com/REcZL_LGu0DaDaC-G7VIbN0uE_5l-i_dw6ZvOETRnY3pRhUmfkOq6C1MLephPZkV4VSzQAhEi_4=s88-c-k-c0x00ffffff-no-rj",
          "profileUrl": "https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow",
          "badges": [
            "Official Artist Channel"
          ]
        }
      }
    ],
    "channels": [],
    "count": 43,
    "pagination": {
      "cursor": "ErMDEgxsb2ZpIGhpcCBob3AaogNTQlNDQVJaU1JFRlVabTFpUnpsdFlWTkNiMkZZUVdkaFJ6bDNnZ0VMY2taYVNFOUliQzFNT0VHQ0FRdHVOakZWVEVWVk4wTlBNSUlCRFZKRWJqWXhWVXhGVlRkRFR6Q0NBU...",
      "hasMore": true
    }
  },
  "meta": {
    "requestId": "pg-audit-r1-youtube-search-1793954286411167200",
    "durationMs": 7991
  },
  "billing": {
    "unitPrice": 0.8,
    "ruleVersion": "social-primary-v2",
    "billedCount": 43,
    "pointCost": 34.4
  }
}

积点消耗说明

每条主体结果消耗 0.8 积点。

空结果、失败响应不扣费。同一响应中相同 ID 只计一次,独立调用和续页分别计费。详见 社媒评论 API 计费说明。

在线调试