虽然我可以在YouTube.com
高级搜索页面上轻松地做到这一点,但我似乎无法让它与他们的 API 一起使用。
例如:从资源管理器页面
有谁知道让它工作的诀窍?
您可以使用 YouTube 数据 API v3 搜索按视频质量、时长、上传日期和关键字进行搜索
https://developers.google.com/youtube/v3/docs/search
您可以使用以下过滤器:
发布之后/日期时间
发布前/日期时间
q / 字符串(关键字)
videoDefinition / 字符串(任何 /high /standard )
videoDuration / 字符串(任何 /long /medium /short )
而且您必须小心并将类型参数设置为视频以指定此过滤器。
这是一个示例调用:
要求:
GET https://www.googleapis.com/youtube/v3/search?part=snippet&publishedAfter=2011-01-01T00%3A00%3A00Z&q=coke&type=video&videoDefinition=high&videoDuration=short&key={YOUR_API_KEY}
回复:
200 OK
- Show headers -
{
"kind": "youtube#searchListResponse",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/aTddnYr9r7d0D4Q5PzPGfWpsecI\"",
"pageInfo": {
"totalResults": 1000000,
"resultsPerPage": 5
},
"nextPageToken": "CAUQAA",
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/Ej9FPd2YyubbQoYtuBZ_tT1Zjck\"",
"id": {
"kind": "youtube#video",
"videoId": "5T68TvdoSbI"
},
"snippet": {
"publishedAt": "2013-06-20T15:00:35.000Z",
"channelId": "UC1zZE_kJ8rQHgLTVfobLi_g",
"title": "Self Freezing Coca-Cola (The trick that works on any soda!)",
"description": "Take any bottle of soda, and get it to freeze on command! This \"super cool\" trick works with cans of soda as well. To date, I haven't seen any tutorials on e...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/5T68TvdoSbI/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/5T68TvdoSbI/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/5T68TvdoSbI/hqdefault.jpg"
}
},
"channelTitle": "01032010814"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/TAH9npB-WK5-tntpUczojivt_nk\"",
"id": {
"kind": "youtube#video",
"videoId": "FaMWxLCGY0U"
},
"snippet": {
"publishedAt": "2011-04-23T00:57:00.000Z",
"channelId": "UCIgKGGJkt1MrNmhq3vRibYA",
"title": "Gallium Induced Structural Failure of a Coke Can",
"description": "We show how a normally strong and robust coke can is turned into the equivalent of wet tissue paper with gallium. If you want some gallium yourself, you can ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/FaMWxLCGY0U/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/FaMWxLCGY0U/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/FaMWxLCGY0U/hqdefault.jpg"
}
},
"channelTitle": "NurdRage"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/ZbkW-ovCwrd7bU0s44Yc6ZNF8uQ\"",
"id": {
"kind": "youtube#video",
"videoId": "KEBJmZL8G1E"
},
"snippet": {
"publishedAt": "2012-06-06T20:16:20.000Z",
"channelId": "UCosXctaTYxN4YPIvI5Fpcrw",
"title": "The Most Outrageous Way to Share a Coke",
"description": "What is the most outrageous way to share a Coke? Watch this video to see what iJustine, Josh TheComputerNerd01 and a few new friends came up with -- an ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/KEBJmZL8G1E/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/KEBJmZL8G1E/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/KEBJmZL8G1E/hqdefault.jpg"
}
},
"channelTitle": "cocacola"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/I04dl1Hbm3FTzhGu8xIbRfHQ5XM\"",
"id": {
"kind": "youtube#video",
"videoId": "b6u9WJ01Oxs"
},
"snippet": {
"publishedAt": "2011-09-28T01:01:55.000Z",
"channelId": "UCUK0HBIBWgM2c4vsPhkYY4w",
"title": "EPIC Mentos and Coke - The Slow Mo Guys",
"description": "Volume UP, Watch in HD! Gav and Dan bring you the most epic mentos and coke video ever. Well, I say epic... It's more accurately the MOST OVERLY DRAMATIC men...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/b6u9WJ01Oxs/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/b6u9WJ01Oxs/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/b6u9WJ01Oxs/hqdefault.jpg"
}
},
"channelTitle": "theslowmoguys"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/JlSU5F38dpMSZwynbS2ztIpSNr8\"",
"id": {
"kind": "youtube#video",
"videoId": "gy5hTC1ox9A"
},
"snippet": {
"publishedAt": "2013-05-29T06:22:07.000Z",
"channelId": "UCDZESjYAwh-ws7ZSZZ8DKeg",
"title": "2 Liter Diet Coke Challenge (No Burping)",
"description": "L.A. BEAST responds to a challenge created by fellow competitive eater Matt \"The Megatoad\" Stonie, in which one must drink an entire 2 liter bottle of Diet C...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/gy5hTC1ox9A/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/gy5hTC1ox9A/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/gy5hTC1ox9A/hqdefault.jpg"
}
},
"channelTitle": "skippy62able"
}
}
]
}