YouTube
javascript:(function () { var get_video_id = function () { return yt.getConfig("VIDEO_ID"); }; var get_title = function () { return yt.getConfig("VIDEO_TITLE"); }; var get_t = function () { return yt.getConfig("SWF_ARGS").t; }; var make_download_url = function (format) { var url = "http://youtube.com/get_video?video_id="; var video_id = get_video_id(); var t = get_t(); url += video_id; url += "&t="; url += t; if (format) { url += "&fmt=" + format; } return url; }; var insert_download_anchor = function () { var as_mp4 = "18"; var url = make_download_url(as_mp4); var title = get_title(); var anchor = document.createElement("a"); anchor.textContent = "Download as MP4"; anchor.href = url; document.getElementById("watch-video-details-inner").appendChild(anchor); }; insert_download_anchor(); })();
YouTubeの動画をMP4としてダウンロードするブックマークレット。普通に動くが、Safariだとファイル名を指定してダウンロードさせられない(YouTubeの動画のヘッダのContent-Dispositionがvideo.mp4になっている)。
で、こういう場合にファイル名を指定するにはredirect.cgi/filename?redirect_to=http...
みたいに、ローカルCGIとApacheの拡張を使ってURLのpathnameをごまかしたりするしかない。どうにも微妙なので、普通にダウンロードしてから手動リネームで我慢…。