
重要说明:part决定返回哪些数据,不要一次性请求全部 part,节约配额(Quota)。
GET https://www.googleapis.com/youtube/v3/videos
?id=dQw4w9WgXcQ
&part=snippet,statistics,contentDetails,status
&key=你的API_KEY{
"kind": "youtube#videoListResponse",
"etag": "\"p4VTdlkQv3HQeTEaXgvLePAydmU/abc123DEF456\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"p4VTdlkQv3HQeTEaXgvLePAydmU/item01\"",
"id": "dQw4w9WgXcQ",
"snippet": {
"publishedAt": "2009-10-25T06:57:33Z",
"channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
"title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
"description": "The official video for Rick Astley's Never Gonna Give You Up",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "Rick Astley",
"tags": [
"Rick Astley",
"Never Gonna Give You Up",
"pop music"
],
"categoryId": "10",
"liveBroadcastContent": "none",
"localized": {
"title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
"description": "The official video for Rick Astley's Never Gonna Give You Up"
}
},
"contentDetails": {
"duration": "PT3M33S",
"dimension": "2d",
"definition": "hd",
"caption": "false",
"licensedContent": true,
"contentRating": {},
"projection": "rectangular"
},
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": true,
"madeForKids": false
},
"statistics": {
"viewCount": "14682956328",
"likeCount": "162354211",
"favoriteCount": "0",
"commentCount": "19743254"
}
}
]
}全部为字符串类型,运算务必转为数字
{
"error": {
"code": 403,
"message": "The request cannot be completed because you have exceeded your quota.",
"errors": [
{
"message": "The request cannot be completed because you have exceeded your quota.",
"domain": "youtube.quota",
"reason": "quotaExceeded"
}
]
}
}{
"kind": "youtube#videoListResponse",
"etag": "\"xxxx\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": []
}{
"error": {
"code": 400,
"message": "Required parameter: part",
"errors": [
{
"message": "Required parameter: part",
"domain": "youtube.parameter",
"reason": "missingRequiredParameter",
"location": "parameters",
"locationType": "parameter"
}
]
}
}YouTube Data API v3 videos.list 是官方标准化海外视频元数据接口,通过传入 VideoId 获取标题、封面、时长、播放点赞评论等结构化信息,广泛用于海外社媒数据分析、选品系统、MCN 数据监控。相比网页爬虫,官方接口稳定性强、格式统一,是海外内容数据项目标准对接方案。
如果你需要,我可以额外配套:
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。