From 1d69bec9d9f528f55928659886cc8d9657e5f0fa Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 7 May 2010 16:48:18 +0000 Subject: Meow Meow Change! git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37418 d0d07461-0603-4401-acd4-de1884942a52 --- stella.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'stella.js') diff --git a/stella.js b/stella.js index 4d6b233..cdd6c76 100644 --- a/stella.js +++ b/stella.js @@ -1007,11 +1007,25 @@ Thanks: set volume (value) (this.player.setVolume(value), this.volume), fetch: function (filepath) { + function _fetch (id, t) { + let url = + "http://youtube.com/get_video?video_id=" + id + + "&t=" + decodeURIComponent(t) + + (quality ? "&fmt=" + quality : ''); + U.download(url, filepath, '.flv', self.title); + } + let self = this; + let id = YouTubePlayer.getIDfromURL(U.currentURL); // all(1080p,720p,480p,360p) -> 37, 22, 35, 34, 5 // FIXME 一番初めが最高画質だと期待 - let quality = content.wrappedJSObject.yt.config_.SWF_CONFIG.args.fmt_map.match(/^\d+/); + let cargs = content.wrappedJSObject.yt.config_.SWF_CONFIG.args + let quality = cargs.fmt_map.match(/^\d+/); + let t = cargs.t; + + // 時間が経っていると無効化されてしまっている + //_fetch(t, id); U.httpRequest( U.currentURL, @@ -1019,12 +1033,7 @@ Thanks: function (xhr) { // XXX t が変わるために、キャッシュを利用できない問題アリアリアリアリ let [, t] = xhr.responseText.match(/swfHTML.*&t=([^&]+)/); - let id = YouTubePlayer.getIDfromURL(U.currentURL); - let url = - "http://youtube.com/get_video?video_id=" + id + - "&t=" + decodeURIComponent(t) + - (quality ? "&fmt=" + quality : ''); - U.download(url, filepath, '.flv', self.title); + _fetch(id, t); } ); }, -- cgit v1.2.3