channel_urlstringbắt buộc
Channel URL.
https://api.sandbase.ai/v1/api/youtube/web/channel-id-v2Resolves a YouTube channel URL into its unique channel ID and standardized channel URL. Accepts various URL formats including handles, custom URLs, and user links.
[
{
"data": {
"channel_id": "UCeu6U67OzJhV1KwBansH3Dg",
"channel_url": "https://www.youtube.com/channel/UCeu6U67OzJhV1KwBansH3Dg"
}
}
]Chọn một ví dụ để nạp đầu vào và kết quả của nó vào playground.
Takes a YouTube channel URL and returns the channel's unique ID and its standard channel URL. The input is channel_url, which can be a handle, custom URL, user link, or channel link.
@handle link into a UC... channel ID before you call other channel APIs.curl -X POST "https://api.sandbase.ai/v1/api/youtube/web/channel-id-v2" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"channel_url": "https://www.youtube.com/@CozyCraftYT"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
channel_url | string | Yes | Channel URL. |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"channel_id": "UCeu6U67OzJhV1KwBansH3Dg",
"channel_url": "https://www.youtube.com/channel/UCeu6U67OzJhV1KwBansH3Dg"
}
| Field | Meaning |
|---|---|
channel_id | The unique YouTube channel ID. It starts with UC, for example UCeu6U67OzJhV1KwBansH3Dg. |
channel_url | The standard channel URL built from the ID, in the form https://www.youtube.com/channel/<channel_id>. |
channel_url. The example uses a handle URL: https://www.youtube.com/@CozyCraftYT.channel_id and inside channel_url, so you can use either one.$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Bắt đầu xây dựng
Endpoint API của nền tảng với xác thực và theo dõi mức sử dụng thống nhất.
curl -X POST "https://api.sandbase.ai/v1/api/youtube/web/channel-id-v2" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel_url": "https://static.sandbase.ai/examples/1e292b4d-4702-4fe1-a012-cba3b931bb0e/input/456962a8-0887-4ca6-aee3-9be7a5538cd5.bin"
}'Đặt SandBase API key của bạn trong môi trường máy chủ. Các request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key của bạn trên máy chủ. Không hiển thị trong mã chạy trên trình duyệt.
channel_urlstringbắt buộcChannel URL.
Đây là phản hồi ví dụ đã lưu cho API này; không có request thực nào được gửi khi xem mục này.
[
{
"data": {
"channel_id": "UCeu6U67OzJhV1KwBansH3Dg",
"channel_url": "https://www.youtube.com/channel/UCeu6U67OzJhV1KwBansH3Dg"
}
}
]Khám phá thêm
| API | Giá | Phản hồi |
|---|---|---|
YouTube | $0.001 mỗi lần gọi | JSON |
YouTube | $0.001 mỗi lần gọi | JSON |
YouTube | $0.001 mỗi lần gọi | JSON |
YouTube | $0.001 mỗi lần gọi | JSON |
YouTube | $0.001 mỗi lần gọi | JSON |
YouTube | $0.001 mỗi lần gọi | JSON |
Câu hỏi
Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/youtube/web/channel-id-v2 với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.
$0.001 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.
Bắt buộc: channel_url (string). Bảng Parameters và Playground trên trang này liệt kê mọi trường.
Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.
Không. YouTube Channel ID from URL (V2) chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của YouTube.