From 357a0dafc75ee396d12c32374c08724cb0801c25 Mon Sep 17 00:00:00 2001
From: anekos
Date: Thu, 6 May 2010 14:24:45 +0000
Subject: YouTube で(たぶん)最高画質の動画をダウンロードできるようにした
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37407 d0d07461-0603-4401-acd4-de1884942a52
---
stella.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/stella.js b/stella.js
index c9dd609..4d6b233 100644
--- a/stella.js
+++ b/stella.js
@@ -39,7 +39,7 @@ let PLUGIN_INFO =
すてら
For Niconico/YouTube/Vimeo, Add control commands and information display(on status line).
ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。
- 0.29.0
+ 0.30.0
anekos
new BSD License (Please read the source code comments of this plugin)
修正BSDライセンス (ソースコードのコメントを参照してください)
@@ -1009,6 +1009,10 @@ Thanks:
fetch: function (filepath) {
let self = this;
+ // all(1080p,720p,480p,360p) -> 37, 22, 35, 34, 5
+ // FIXME 一番初めが最高画質だと期待
+ let quality = content.wrappedJSObject.yt.config_.SWF_CONFIG.args.fmt_map.match(/^\d+/);
+
U.httpRequest(
U.currentURL,
null,
@@ -1016,7 +1020,10 @@ Thanks:
// 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);
+ let url =
+ "http://youtube.com/get_video?video_id=" + id +
+ "&t=" + decodeURIComponent(t) +
+ (quality ? "&fmt=" + quality : '');
U.download(url, filepath, '.flv', self.title);
}
);
--
cgit v1.2.3