我想检测视频是否可以在Youtube外部播放。我目前正在检测版权侵权,可嵌入和“可合成”的限制。我用这些调用两次API,一次在版本3中,一次在版本2中:
http://gdata.youtube.com/feeds/api/videos/{videoId}?v=2&alt=jsonc
https://www.googleapis.com/youtube/v3/videos?id={videoId}&key={key}&part=status
Run Code Online (Sandbox Code Playgroud)
对于视频(https://www.youtube.com/watch?v=TzmyOT1kcfc),我得到了以下答案:
{
"kind": "youtube#videoListResponse",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/yoB7kT2xS4cnv1zDF-EiUrfidKQ\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/mk9sFeT7lpR0qthcrYeJssWlayY\"",
"id": "TzmyOT1kcfc",
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": true
}
"player": {
"embedHtml": "<iframe type='text/html' src='http://www.youtube.com/embed/TzmyOT1kcfc' width='640' height='360' frameborder='0' allowfullscreen='true'/>"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
和:
{
"apiVersion": "2.1",
"data": {
"id": "TzmyOT1kcfc",
"uploaded": "2014-08-07T11:13:03.000Z",
"updated": "2014-09-22T01:13:46.000Z",
"uploader": "topgear",
"category": "Autos",
"title": "Aston Martin: DBS vs DB9 and Vanquish (HQ) - …Run Code Online (Sandbox Code Playgroud)