YouTube API Service === 视频相关 API === 获取字幕: /transcript?url=YouTubeVideoURL&lang=languageCode&location=locationCode 获取完整字幕数据: /subtitle?url=YouTubeVideoURL&lang=languageCode&location=locationCode 获取元数据: /metadata?url=YouTubeVideoURL&lang=languageCode&location=locationCode 获取视频下载链接: /download?url=YouTubeVideoURL&lang=languageCode&location=locationCode 获取评论: /comments?url=YouTubeVideoURL&limit=20&lang=languageCode&location=locationCode 获取评论回复: /comments/replies?url=YouTubeVideoURL&comment_id=commentId&limit=20&lang=languageCode&location=locationCode 获取完整数据(元数据+字幕+评论): /full?url=YouTubeVideoURL&comments_limit=20&lang=languageCode&location=locationCode 获取原始数据(不经过处理的API响应): /raw?url=YouTubeVideoURL&lang=languageCode&location=locationCode === 视频专用端点 (别名) === /video/download?url=YouTubeVideoURL&lang=languageCode&location=locationCode /video/transcript?url=YouTubeVideoURL&lang=languageCode&location=locationCode /video/metadata?url=YouTubeVideoURL&lang=languageCode&location=locationCode /video/subtitle?url=YouTubeVideoURL&lang=languageCode&location=locationCode === 频道相关 API === 获取频道信息: /channel?url=YouTubeChannelURL&include_videos=true&video_limit=20&include_shorts=true&include_posts=true&lang=languageCode&location=locationCode === 搜索相关 API === 搜索视频: /search?q=searchQuery&type=video&upload_date=week&duration=short&sort_by=view_count&features=hd,subtitles&lang=languageCode&location=locationCode 获取搜索建议: /search/suggestions?q=searchQuery&lang=languageCode&location=locationCode === 内容发现 API === 获取趋势视频: /trending?region=regionCode&type=video 获取标签内容: /hashtag?hashtag=hashtagName&limit=20&lang=languageCode&location=locationCode 获取播放列表: /playlist?url=YouTubePlaylistURL&lang=languageCode&location=locationCode === 系统相关 API === 缓存状态: /cache/stats 支持的国家/地区列表: /countries 参数说明: === 基础参数 === - url: YouTube视频/频道/播放列表URL或ID (必需,用于视频/频道/播放列表相关API) - q: 搜索关键词 (必需,用于搜索API) - hashtag: 标签名称 (必需,用于标签API,不包含#符号) - comment_id: 评论ID (必需,用于获取评论回复) - lang: 语言代码 (可选,默认: en) - location: YouTube区域代码 (可选,默认: US) === 数量限制参数 === - limit: 通用数量限制 (可选,默认: 20,用于评论、标签内容等) - comments_limit: 完整数据中的评论数量限制 (可选,默认: 20) - video_limit: 视频数量限制 (可选,1-50,默认: 10) === 搜索过滤参数 === - type: 搜索类型 (可选,all|video|channel|playlist|movie,默认: all) - upload_date: 上传时间过滤 (可选,all|hour|today|week|month|year,默认: all) - duration: 时长过滤 (可选,all|short|medium|long,默认: all) - sort_by: 排序方式 (可选,relevance|rating|upload_date|view_count,默认: relevance) - features: 特性过滤 (可选,用逗号分隔: hd,subtitles,creative_commons,3d,live,purchased,4k,360,location,hdr,vr180) === 频道内容参数 === - include_videos: 是否包含视频列表 (可选,true|false,默认: false) - include_shorts: 是否包含Shorts (可选,true|false,默认: false) - include_posts: 是否包含社区帖子 (可选,true|false,默认: false) === 趋势视频参数 === - region: 获取趋势视频的区域代码 (可选,默认: US) - type: 趋势类型 (可选,video|music|gaming|movies,默认: video) === 使用示例 === # 获取视频信息 curl "https://your-worker.workers.dev/metadata?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ" # 搜索视频 curl "https://your-worker.workers.dev/search?q=javascript tutorial&type=video&duration=medium" # 获取频道完整信息 curl "https://your-worker.workers.dev/channel?url=@Fireship&include_videos=true&include_shorts=true" # 获取标签内容 curl "https://your-worker.workers.dev/hashtag?hashtag=javascript&limit=10" # 获取趋势视频 curl "https://your-worker.workers.dev/trending?region=US&type=music" # 获取支持的国家列表 curl "https://your-worker.workers.dev/countries"