動画がYoutubeの外で再生可能かどうかを検出したい。現在、著作権侵害、埋め込みおよび「シンジケート可能」の制限を検出しています。これらを使用して、バージョン 3 で 1 回、バージョン 2 で 1 回、2 回 API を呼び出しています。
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
ビデオ ( 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'/>"
}
}
]
}
と :
{
"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) - Top Gear - Series 10 - BBC",
"description": "Jeremy test drives the flashy Aston Martin DBS. Clip taken from series 10, episode 6.\n\nSubscribe for more awesome Top Gear videos: http://www.youtube.com/subscription_center?add_user=Topgear\n\nTop Gear YouTube channel: http://www.youtube.com/topgear\nTopGear.com website: http://www.topgear.com\n\nTop Gear Facebook: http://www.facebook.com/topgear\nTop Gear Twitter: http://twitter.com/BBC_topgear\n\nThis is a channel from BBC Worldwide who help fund new BBC programmes.",
"thumbnail": {
"sqDefault": "http://i.ytimg.com/vi/TzmyOT1kcfc/default.jpg",
"hqDefault": "http://i.ytimg.com/vi/TzmyOT1kcfc/hqdefault.jpg"
},
"player": {
"default": "http://www.youtube.com/watch?v=TzmyOT1kcfc&feature=youtube_gdata_player",
"mobile": "http://m.youtube.com/details?v=TzmyOT1kcfc"
},
"content": {
"1": "rtsp://r6---sn-5hn7su7k.c.youtube.com/CiILENy73wIaGQn3cWQ9ObI5TxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp",
"5": "http://www.youtube.com/v/TzmyOT1kcfc?version=3&f=videos&app=youtube_gdata",
"6": "rtsp://r6---sn-5hn7su7k.c.youtube.com/CiILENy73wIaGQn3cWQ9ObI5TxMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"
},
"duration": 438,
"aspectRatio": "widescreen",
"rating": 4.917057,
"likeCount": "2928",
"ratingCount": 2990,
"viewCount": 320436,
"favoriteCount": 0,
"commentCount": 143,
"accessControl": {
"comment": "allowed",
"commentVote": "allowed",
"videoRespond": "moderated",
"rate": "allowed",
"embed": "allowed",
"list": "allowed",
"autoPlay": "allowed",
"syndicate": "allowed"
}
}
}
したがって、ビデオは「シンジケート可能」(モバイルで表示可能) であり、埋め込み可能ですが、埋め込み可能ではありません ( https://www.youtube.com/embed/TzmyOT1kcfc?autoplay=true ==> ページを更新します)。公式の Youtube SDK を使用しているため、ビデオは Android アプリで再生されているため、Google の場合、アプリケーションのこの部分は Youtube の一部であると推測しています。
問題は、なぜ両方の呼び出しで、API は埋め込み可能であると教えてくれるのに、埋め込み可能ではないのかということです。
パラメータとして「autoplay=true」を使用して埋め込みプレーヤーを起動すると返される HTML でクラス「ytp-error html5-stop-propagation」を検索できることがわかりましたが、それぞれの HTML を解析するには非常にコストがかかります。ユーチューブ動画。動画が本当に埋め込み可能かどうかを確認する別の方法はありますか?
最後の質問: このトピックで提供した埋め込みプレーヤーをクリックします。最初は機能しますが、ページを更新すると機能しません。なんで?