[YouTube]Chromelessプレイヤータグ【AppleScript】
YouTubeのクロムレスプレイヤー用のタグを
AppleScriptで作ります。
共有用URLから生成します。
display dialog "ShareからコピーしたURLを入力" default answer "" with icon 1 default button 2
set GetUrl to text returned of the result as Unicode text
set CntGetUrl to the length of characters of GetUrl
considering case
set cn to the offset of "v=" in GetUrl
end considering
set Vid to characters (cn + 2) thru (cn + 12) of GetUrl as Unicode text
set h_width to "570" as number
set v_hight to (h_width / 16 * 9) as integer
set HTMLtag to "" as Unicode text
set HTMLtag to HTMLtag & "<script src=\"http://www.google.com/jsapi\" type=\"text/javascript\"></script>" & return as Unicode text
set HTMLtag to HTMLtag & "<script type=\"text/javascript\" charset=\"utf-8\">google.load(\"swfobject\", \"2.2\");</script>" & return as Unicode text
set HTMLtag to HTMLtag & "<div id=\"videoDiv\">Loading...</div> " & return as Unicode text
set HTMLtag to HTMLtag & "<script type=\"application/javascript\" language=\"javascript\"> " & return as Unicode text
set HTMLtag to HTMLtag & "function updateHTML(elmId, value) {" & return as Unicode text
set HTMLtag to HTMLtag & "document.getElementById(elmId).innerHTML = value;}" & return as Unicode text
set HTMLtag to HTMLtag & "function onYouTubePlayerReady(playerId) {" & return as Unicode text
set HTMLtag to HTMLtag & "ytplayer = document.getElementById(\"ytPlayer\");" & return as Unicode text
set HTMLtag to HTMLtag & "ytplayer.cueVideoById(\"" & Vid & "\");}" & return as Unicode text
set HTMLtag to HTMLtag & "function loadPlayer() {" & return as Unicode text
set HTMLtag to HTMLtag & "var params = { allowScriptAccess: \"always\" };" & return as Unicode text
set HTMLtag to HTMLtag & "var atts = { id: \"ytPlayer\" };" & return as Unicode text
set HTMLtag to HTMLtag & "swfobject.embedSWF(\"http://www.youtube.com/apiplayer?\" +" & return as Unicode text
set HTMLtag to HTMLtag & "\"enablejsapi=1&version=3&enablejsapi=1&playerapiid=player1\", " & return as Unicode text
set HTMLtag to HTMLtag & "\"videoDiv\", \"" & h_width & "\", \"" & v_hight & "\", \"10.0.0\", null, null, params, atts);}" & return as Unicode text
set HTMLtag to HTMLtag & "function _run() {" & return as Unicode text
set HTMLtag to HTMLtag & "loadPlayer();}" & return as Unicode text
set HTMLtag to HTMLtag & "google.setOnLoadCallback(_run);" & return as Unicode text
set HTMLtag to HTMLtag & "</script> " & return as Unicode text
display dialog "タグが出来ましたコピーしてください" default answer HTMLtag with icon 1 default button 1
| 固定リンク
「YouTube」カテゴリの記事
- [TTML]60分カウントアップ カウントダウン(2024.02.05)
- 【過去記事フォロー】YouTubeのサムネイル(2022.06.17)
- 【過去記事フォロー】[YouTube]YouTubeのサムネイル画像(default.webp mqdefault.webp hqdefault.webp sddefault.webp maxresdefault.webp)(2016.03.02)
- [MPEG-DASH]YouTubeビデオをダウンロードする。(2014-15版)(2015.04.05)
- [YouTube]YouTubeのサムネイル画像(default.jpg mqdefault.jpg hqdefault.jpg sddefault.jpg maxresdefault.jpg)(2013.08.08)
この記事へのコメントは終了しました。
コメント