第23章 API - Channels 端点
第23章 API - Channels 端点
如需了解下文使用的各种 JSON 对象的详细信息,请参阅通用对象类型页面。
GET /api/v1/channels/:id
响应:
{ "author": String, "authorId": String, "authorUrl": String, "authorVerified": Boolean, "authorBanners": [ // 一个或多个 ImageObject ], "authorThumbnails": [ // 一个或多个 ImageObject ],
"subCount": Number, // 整数 "totalViews": Number, // 整数 "joined": Number, // Unix 时间戳
"autoGenerated": Boolean, "isFamilyFriendly": Boolean,
"description": String, "descriptionHtml": String, "allowedRegions": String[],
"tabs": String[], "pronouns": String?
"latestVideos": [ // 一个或多个 VideoObject ], "relatedChannels": [ // 一个或多个 ChannelObject ] }
GET /api/v1/channels/:id/channels
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。
响应:
{ "relatedChannels": [ // 一个或多个 ChannelObject ], "continuation": String }
GET /api/v1/channels/:id/latest 这与不带 URL 参数请求 /api/v1/channels/:id/videos 效果相同。 GET /api/v1/channels/:id/playlists
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。 sort_by: 排序筛选器。可接受的值:oldest、newest、last。默认为 last。
响应:
{ "playlists": [ // 一个或多个 PlaylistOject ], "continuation": continuation }
GET /api/v1/channels/:id/podcasts
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。
响应:
{ "playlists": [ // 一个或多个 PlaylistOject ], "continuation": continuation }
GET /api/v1/channels/:id/releases
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。
响应:
{ "playlists": [ // 一个或多个 PlaylistOject ], "continuation": continuation }
GET /api/v1/channels/:id/shorts
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。 sort_by: 排序筛选器。可接受的值:newest、popular 或 oldest
响应:
参见:GET /api/v1/channels/:id/videos GET /api/v1/channels/:id/streams
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。 sort_by: 排序筛选器。可接受的值:newest、popular 或 oldest
响应:
参见:GET /api/v1/channels/:id/videos GET /api/v1/channels/:id/videos
URL 参数:
continuation: 用于获取下一批数据项的延续令牌。该令牌会在每次请求此 API 时提供。 sort_by: 排序筛选器。可接受的值:newest、popular 或 oldest(自 2022 年 10 月起损坏)。默认为 newest。
响应:
{ "videos": [ // 一个或多个 VideoObject ], "continuation": String }
GET /api/v1/channels/:id/community 如需了解下文使用的附加 JSON 对象的详细信息,请参阅下文关于社区帖子附加类型的说明。
URL 参数
continuation: 用于获取下一批数据项的延续令牌。
响应:
{ "authorId": String, "comments": { "attachment": ImageAttachment | MultiImageAttachment | VideoAttachment | PollAttachment | PlaylistAttachment "author": String, "authorIsChannelOwner": Boolean "authorId": String, "authorThumbnails": ImageObject[], "authorUrl": String, "commentId": String, "content": String, "contentHtml": String, "isEdited": Boolean, "likeCount": Number, "published": Number, "publishedText": String, "replyCount": Number }[] }
社区帖子附加类型 VideoAttachment 参见 VideoObject 通用类型 PlaylistAttachment 参见 PlaylistObject 通用类型 ImageAttachment { "type": "image", "imageThumbnails": ImageObject[] }
MultiImageAttachment { "type": "multiImage", "images": ImageObject[][] }
PollAttachment { "type": "poll", "totalVotes": Number, "choices": { "text": String, "image?": ImageObject[] }[]
}
未知 这通常意味着该附加类型的解析支持尚未实现。 { "type": "unknown", "error": String }
GET /api/v1/channels/:ucid/search
URL 参数 * q: 搜索查询 * page: 搜索结果页码(Int32) 响应: [ VideoObject, PlaylistObject ];
GET /api/v1/post/:id
URL 参数
ucid: 建议提供频道 ID 以获取帖子。
响应: 与 /api/v1/channels/:id/community 相同,但 comments 数组中仅返回一条帖子
GET /api/v1/post/:id/comments
URL 参数
ucid: 需要提供频道 ID 以获取帖子的评论。 sort_by: "top"、"new"(默认:top)
响应: 与 /api/v1/channels/:id/comments 相同,但使用 postId 代替 videoId