API Hop

文档目录

API Hop 文档

YouTube 接口参考

通过 34 个需要鉴权的接口查询 YouTube 视频、频道、Shorts、评论、社区帖子、搜索结果与媒体流元数据,其中 32 个为 GET,2 个为 POST。

选择接口后,仅传入其文档列出的字段。列出可选字段组时,每组至少提供一个字段。分页参数须取自上一页响应,不会自动翻页。

GET 接口使用查询参数,不接受请求体。V3 媒体流接口使用 POST application/json 请求体,不接受查询参数;proxy_url 只能放在请求体中。版本路径选择 YouTube 接口版本。未知字段或重复字段会被拒绝。用户标识和分页游标须保留为字符串,包括超出 JavaScript 安全整数范围的值。

同步请求的计费规则:按成功请求次数计费,不按返回条数计费;每一页单独计费。多数接口为 $0.001;两个 V2 搜索变体为 $0.002,V2 媒体流变体为 $0.004。具体价格见各接口。 账户专属价格优先。供应商按用量提供的折扣不会自动转为客户折扣。上游调用失败会释放预扣,结算失败返回错误且不会再次调用上游。

字幕任务

POST https://api.apihop.ai/v1/youtube/web-v2/videos/captions 返回 HTTP 202、平台任务 ID 和 Location: /v1/jobs/\{id\}。每隔 2–5 秒调用 GET https://api.apihop.ai/v1/youtube/web-v2/videos/captions/result?job_id=\{id\} 查询,仅任务所属租户可读取。结果查询免费;创建请求的目录价为 $0.008。无字幕也是成功结果,正常计费。格式在创建时固定,默认 srt;查询时可选的 format 必须一致,否则返回 HTTP 400。任务达到 COMPLETED 前 data.result 为 null,也可能以 FAILED 结束。接口仅获取已有字幕,不提供 AI 转写。

提交是否被上游接受无法确认时,不会重放请求,预扣可能保留至 30 分钟任务期限。上游已返回终态时,平台仍可能等待结算对账后再完成任务。临时轮询错误不代表任务最终失败。

json
{"success":true,"data":{"id":"9007199254740993001","status":"PROCESSING","result":null},"requestId":"example"}

范围与限制

web 和 web-v2 路径选择上游接口系列。V3 支持通过 POST 使用自带固定出口 HTTP 代理获取媒体流链接。媒体流接口返回元数据和 URL,不返回媒体文件,也不保证下载成功。频道描述可能需要使用 continuation_token 再发起一次单独计费的请求。不会自动重试。

web-get_relate_video

GET https://api.apihop.ai/v1/youtube/web/videos/related

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
video_id是string
continuation_token否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/videos/related" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=LuIL5JATZsc"

web-search_video

GET https://api.apihop.ai/v1/youtube/web/search/videos

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
search_query是string
language_code否string; default: "en"
order_by否string; default: "this_month"
country_code否string; default: "us"
continuation_token否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/search/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "search_query=Minecraft"

web-get_channel_id

GET https://api.apihop.ai/v1/youtube/web/channels/id

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_name是string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/channels/id" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_name=LinusTechTips"

web-get_channel_id_v2

GET https://api.apihop.ai/v1/youtube/web/channels/id/by-url

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_url是string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/channels/id/by-url" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_url=https://www.youtube.com/@CozyCraftYT"

web-get_channel_url

GET https://api.apihop.ai/v1/youtube/web/channels/url

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/channels/url" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCeu6U67OzJhV1KwBansH3Dg"

web-get_channel_info

GET https://api.apihop.ai/v1/youtube/web/channels/info

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/channels/info" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw"

web-get_channel_short_videos

GET https://api.apihop.ai/v1/youtube/web/channels/shorts

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
continuation_token否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/channels/shorts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw"

web-search_channel

GET https://api.apihop.ai/v1/youtube/web/channels/search

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
search_query是string
language_code否string; default: "en"
country_code否string; default: "us"
continuation_token否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web/channels/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw" \
  --data-urlencode "search_query=AMD"

web_v2-get_video_info

GET https://api.apihop.ai/v1/youtube/web-v2/videos/info

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
video_id是string; minLength: 11; maxLength: 11
language_code否string; default: "zh-CN"
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/info" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=oaSNBz4qMQY"

web_v2-get_video_info_v2

GET https://api.apihop.ai/v1/youtube/web-v2/videos/info-v2

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: video_id, video_url.

字段必填约束
video_id否string
video_url否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/info-v2" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=dQw4w9WgXcQ"

web_v2-get_video_comments

GET https://api.apihop.ai/v1/youtube/web-v2/videos/comments

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
video_id是string; minLength: 11; maxLength: 11
language_code否string; default: "zh-CN"
country_code否string; default: "US"
sort_by否string; top, newest; default: "top"
continuation_token否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/comments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=LuIL5JATZsc"

web_v2-get_video_comment_replies

GET https://api.apihop.ai/v1/youtube/web-v2/videos/comments/replies

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
continuation_token是string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/comments/replies" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "continuation_token=example"

web_v2-get_channel_description

GET https://api.apihop.ai/v1/youtube/web-v2/channels/description

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: channel_id, continuation_token.

字段必填约束
channel_id否string
continuation_token否string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/channels/description" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCeu6U67OzJhV1KwBansH3Dg"

GET https://api.apihop.ai/v1/youtube/web-v2/search

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
search_query是string; maxLength: 200
language_code否string; default: "zh-CN"
country_code否string; default: "US"
time_zone否string; default: "America/Los_Angeles"
upload_time否string; hour, today, week, month, year
duration否string; short, medium, long
content_type否string; video, channel, playlist, movie
feature否string; live, 4k, hd, subtitles, creative_commons, 360, vr180, 3d, hdr, location, purchased
sort_by否string; relevance, upload_date, view_count, rating
continuation_token否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "search_query=Python编程"

web_v2-get_general_search_v2

GET https://api.apihop.ai/v1/youtube/web-v2/search-v2

每次成功请求价格: $0.002 (2000 credits).

至少提供一个: keyword, continuation_token.

字段必填约束
keyword否string; maxLength: 200
continuation_token否string
upload_date否string; last_hour, today, this_week, this_month, this_year
type否string; video, channel, playlist, movie
duration否string; short, medium, long
features否string
sort_by否string; relevance, upload_date, view_count, rating
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/search-v2" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "keyword=Python tutorial"

GET https://api.apihop.ai/v1/youtube/web-v2/search/shorts

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
search_query是string; maxLength: 200
language_code否string; default: "en-US"
country_code否string; default: "US"
time_zone否string; default: "America/Los_Angeles"
upload_time否string; hour, today, week, month, year
sort_by否string; relevance, upload_date, view_count, rating
continuation_token否string
filter_mixed_content否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/search/shorts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "search_query=Python编程"

web_v2-get_shorts_search_v2

GET https://api.apihop.ai/v1/youtube/web-v2/search/shorts-v2

每次成功请求价格: $0.002 (2000 credits).

至少提供一个: keyword, continuation_token.

字段必填约束
keyword否string; maxLength: 200
continuation_token否string
upload_date否string; last_hour, today, this_week, this_month, this_year
sort_by否string; relevance, upload_date, view_count, rating
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/search/shorts-v2" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "keyword=coding tips"

web_v2-get_channel_id

GET https://api.apihop.ai/v1/youtube/web-v2/channels/id

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_url是string
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/channels/id" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_url=https://www.youtube.com/@CozyCraftYT"

web_v2-get_channel_url

GET https://api.apihop.ai/v1/youtube/web-v2/channels/url

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/channels/url" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCeu6U67OzJhV1KwBansH3Dg"

web_v2-get_channel_videos

GET https://api.apihop.ai/v1/youtube/web-v2/channels/videos

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
continuation_token否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/channels/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCJHBJ7F-nAIlMGolm0Hu4vg"

web_v2-get_video_streams

GET https://api.apihop.ai/v1/youtube/web-v2/videos/streams

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: video_id, video_url.

字段必填约束
video_id否string
video_url否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/streams" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=dQw4w9WgXcQ"

web_v2-get_video_streams_v2

GET https://api.apihop.ai/v1/youtube/web-v2/videos/streams-v2

每次成功请求价格: $0.004 (4000 credits).

至少提供一个: video_id, video_url.

字段必填约束
video_id否string
video_url否string
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/streams-v2" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=dQw4w9WgXcQ"

web_v2-get_signed_stream_url

GET https://api.apihop.ai/v1/youtube/web-v2/videos/streams/signed-url

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: video_id, video_url.

字段必填约束
video_id否string
video_url否string
itag是integer
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/streams/signed-url" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "itag=18" \
  --data-urlencode "video_id=dQw4w9WgXcQ"

web_v2-get_video_captions

POST https://api.apihop.ai/v1/youtube/web-v2/videos/captions

每次成功请求价格: $0.008 (8000 credits).

至少提供一个: video_id, video_url.

字段必填约束
video_id否string
video_url否string
language_code否string
format否string; srt, xml, json3, txt; default: "srt"
bash
curl -X POST "https://api.apihop.ai/v1/youtube/web-v2/videos/captions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"format":"srt","video_id":"dQw4w9WgXcQ"}'

web_v2-get_video_captions_result

GET https://api.apihop.ai/v1/youtube/web-v2/videos/captions/result

每次成功请求价格: $0 (0 credits).

字段必填约束
job_id是string; ^[1-9][0-9]{0,18}$
format否string; srt, xml, json3, txt; default: "srt"
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/captions/result" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "job_id=9007199254740993001"

GET https://api.apihop.ai/v1/youtube/web-v2/videos/related

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: video_id, video_url.

字段必填约束
video_id否string
video_url否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/videos/related" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "video_id=dQw4w9WgXcQ"

web_v2-get_channel_shorts

GET https://api.apihop.ai/v1/youtube/web-v2/channels/shorts

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: channel_id, channel_url.

字段必填约束
channel_id否string
channel_url否string
continuation_token否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/channels/shorts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCuAXFkgsw1L7xaCfnd5JJOw"

web_v2-get_search_suggestions

GET https://api.apihop.ai/v1/youtube/web-v2/search/suggestions

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
keyword是string; maxLength: 200
language否string; default: "en"
region否string; default: "US"
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/search/suggestions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "keyword=Rick Astley"

web_v2-search_channels

GET https://api.apihop.ai/v1/youtube/web-v2/search/channels

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: keyword, continuation_token.

字段必填约束
keyword否string; maxLength: 200
continuation_token否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/search/channels" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "keyword=Rick Astley"

web_v2-get_channel_community_posts

GET https://api.apihop.ai/v1/youtube/web-v2/channels/posts

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
channel_id是string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
continuation_token否string
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/channels/posts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "channel_id=UCkRfArvrzheW2E7b6SVT7vQ"

web_v2-get_post_detail

GET https://api.apihop.ai/v1/youtube/web-v2/posts/detail

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
post_id是string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/posts/detail" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "post_id=UgkxiCSRfD6g7SPlWGPDa3vbP7aIsytXRkvy"

web_v2-get_post_comments

GET https://api.apihop.ai/v1/youtube/web-v2/posts/comments

每次成功请求价格: $0.001 (1000 credits).

至少提供一个: post_id, continuation_token.

字段必填约束
post_id否string
continuation_token否string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/posts/comments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "post_id=UgkxiCSRfD6g7SPlWGPDa3vbP7aIsytXRkvy"

web_v2-get_post_comment_replies

GET https://api.apihop.ai/v1/youtube/web-v2/posts/comments/replies

每次成功请求价格: $0.001 (1000 credits).

字段必填约束
continuation_token是string
language_code否string; default: "zh-CN"
country_code否string; default: "US"
need_format否boolean; default: true
bash
curl --get "https://api.apihop.ai/v1/youtube/web-v2/posts/comments/replies" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "continuation_token=example"

web_v2-get_video_streams_v3

POST https://api.apihop.ai/v1/youtube/web-v2/videos/streams-v3

每次成功请求价格: $0.003 (3000 credits).

V3 媒体流通过 HTTPS 使用 POST JSON,每次成功请求为 $0.003。提供 video_id 和 proxy_url(http://、显式端口及公网地址);禁止内网、回环及链路本地地址,凭据中的保留字符须 URL 编码。使用固定出口或粘性代理会话。itags 默认 ["137", "140"];所选格式不存在时失败,不自动替换。verify_download 默认为 false。下载须使用同一代理会话和实际公网出口 IP,并携带 streams[].download_headers。成功获取链接的 HTTP 200 会计费,即使 all_selected_streams_verified 或 streams[].verified 为 false。验证仅抽样读取少量字节,不代表完整文件已验证。链接和代理会话独立过期,分离音视频须自行合并。

字段必填约束
video_id是string; ^[A-Za-z0-9_-]{11}$
proxy_url是string; minLength: 1; maxLength: 2048; writeOnly: true
itags否array; items: string ^[0-9]+$; minItems: 1; maxItems: 4; uniqueItems: true; default: ["137","140"]
verify_download否boolean; default: false
bash
curl -X POST "https://api.apihop.ai/v1/youtube/web-v2/videos/streams-v3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"video_id":"phlZ2J3x4hI","proxy_url":"http://USERNAME:PASSWORD@proxy.example.com:1000","itags":["137","140"],"verify_download":false}'

响应

同步接口保留上游原始 JSON 响应。字幕接口返回 success、data.id、data.status、data.result 和 requestId。下方示例仅作说明,不是实时结果。

json
{"code":200,"data":{"channel_id":"UCXuqSBlHAE6Xw-yeJA0Tunw"}}

错误

平台以 HTTP 400 表示参数错误、401 表示鉴权失败、402 表示余额不足、403 表示无网关权限、429 表示限流、5xx 表示服务或供应商故障。排查时请保留 X-Request-Id。上游 HTTP 200 中的失败业务码不代表成功。

来源

接口与价格于 2026-10-31 按官方接口定义和实时价格元数据核对。文字说明与实时元数据冲突时,以实时元数据为准。

TikHub · OpenAPI · Prices