diff options
author | drry | 2008-11-18 12:33:01 +0000 |
---|---|---|
committer | drry | 2008-11-18 12:33:01 +0000 |
commit | 91483bd9350b2f9b8025432d7963ae68fdc8a5f3 (patch) | |
tree | f150046bfd67e1fe5f35146b908cce6821cfd23c /fetchyoutube.js | |
parent | 4cd2f4825631821bec16d508377a9ae669a4923a (diff) | |
download | vimperator-plugins-91483bd9350b2f9b8025432d7963ae68fdc8a5f3.tar.bz2 |
* 「youtube」を「YouTube」に変更しました。
* ほか。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24157 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'fetchyoutube.js')
-rw-r--r-- | fetchyoutube.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fetchyoutube.js b/fetchyoutube.js index 58eb55c..c99b071 100644 --- a/fetchyoutube.js +++ b/fetchyoutube.js @@ -1,6 +1,6 @@ // ==VimperatorPlugin== -// @name Fetch Youtube Video -// @description Fetch Youtube Video (fmt=22) +// @name Fetch YouTube Video +// @description Fetch YouTube Video (fmt=22) // @license Creative Commons 2.1 (Attribution + Share Alike) // @version 1.0 // @author anekos (anekos@snca.net) @@ -10,7 +10,7 @@ // // Usage: // :fetchyoutube -// Download youtube video to default download directory. +// Download YouTube video to default download directory. // (pref: browser.download.dir) // // Links: @@ -19,7 +19,7 @@ (function () { function fixFilename (filename) { - const badChars = /[\\\/:;\*\?\"\<\>\|]/g; + const badChars = /[\\\/:;*?"<>|]/g; return filename.replace(badChars, '_'); } @@ -36,13 +36,13 @@ } function fetch (arg) { + let doc = content.document; + if (!doc.location.href.match(/http:\/\/(?:[^.]+\.)?youtube\.com\/watch/)) + return; let filepath = arg.string; let dir = options.getPref('browser.download.dir'); let as = content.document.defaultView.wrappedJSObject.swfArgs; - let doc = content.document; let title = doc.title.replace(/^YouTube - /, ''); - if (!doc.location.href.match(/http:\/\/[a-zA-Z\.]*youtube\.com\/watch/)) - return; let url = 'http://www.youtube.com/get_video?fmt=22&video_id=' + as.video_id + '&t=' + as.t; let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager); @@ -73,7 +73,7 @@ commands.addUserCommand( ['fetchyoutube', 'fetchyt'], - 'fecth youtube HD video', + 'fecth YouTube HD video', fetch, {argCount: '*', completer: completion.file}, true |