Created
January 16, 2012 12:41
-
-
Save ww24/1620696 to your computer and use it in GitHub Desktop.
YouTube getVideoURL Bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){if(typeof(yt)==="undefined"){alert("このページでは実行できません");return false}var v=yt.playerConfig.args.url_encoded_fmt_stream_map.split(","),d=document,b=d.getElementsByTagName("body")[0],u=d.createElement("ul"),a,i;u.style["list-style-type"]="decimal";u.style.padding="10px 20px";u=b.insertBefore(u,b.firstChild);for(i=0;v.length>i;i++){v[i]=decodeURIComponent(v[i].split("url=")[1]).split("&type=");v[i][1]=v[i][1].split("&itag=").join(" [fmt=")+"]";a=d.createElement("a");a.href=v[i][0];a.innerText=v[i][1];u.appendChild(d.createElement("li")).appendChild(a)}})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
if (typeof(yt) === "undefined") { | |
alert("このページでは実行できません"); | |
return false; | |
} | |
var video_list = yt.playerConfig.args.url_encoded_fmt_stream_map.split(","), | |
d = document, | |
body = d.getElementsByTagName("body")[0], | |
ul = d.createElement("ul"), | |
a, i; | |
ul.style["list-style-type"] = "decimal"; | |
ul.style.padding = "10px 20px"; | |
ul = body.insertBefore(ul, body.firstChild); | |
for (i=0; video_list.length>i; i++) { | |
video_list[i] = decodeURIComponent(video_list[i].split("url=")[1]).split("&type="); | |
video_list[i][1] = video_list[i][1].split("&itag=").join(" [fmt=") + "]"; | |
a = d.createElement("a"); | |
a.href = video_list[i][0]; | |
a.innerText = video_list[i][1]; | |
ul.appendChild(d.createElement("li")).appendChild(a); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
YouTubeの仕様変更に伴い、
yt.getConfig("PLAYER_CONFIG") → yt.playerConfig
に変更。