From 91483bd9350b2f9b8025432d7963ae68fdc8a5f3 Mon Sep 17 00:00:00 2001 From: drry Date: Tue, 18 Nov 2008 12:33:01 +0000 Subject: * 「youtube」を「YouTube」に変更しました。 * ほか。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24157 d0d07461-0603-4401-acd4-de1884942a52 --- fetchyoutube.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'fetchyoutube.js') 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 -- cgit v1.2.3