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