aboutsummaryrefslogtreecommitdiffstats
path: root/ldrize_cooperation_fetch_flv.js
diff options
context:
space:
mode:
authortrapezoid2008-04-03 11:43:07 +0000
committertrapezoid2008-04-03 11:43:07 +0000
commite3eeee80ce604cc23e6d8b5d26b64ec611679bcb (patch)
tree1746c1396d3341a6da4a06dfb196739eb7a8e94a /ldrize_cooperation_fetch_flv.js
parentc5d3dfc062b41d8cb11c8c29dad9c11a88a133a6 (diff)
downloadvimperator-plugins-e3eeee80ce604cc23e6d8b5d26b64ec611679bcb.tar.bz2
lang/javascript/vimperator-scripts/trunk/ldrize_cooperation_fetch_flv.js: optimize flv file name
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@8790 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'ldrize_cooperation_fetch_flv.js')
-rwxr-xr-xldrize_cooperation_fetch_flv.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ldrize_cooperation_fetch_flv.js b/ldrize_cooperation_fetch_flv.js
index 9e3c545..d4b61bc 100755
--- a/ldrize_cooperation_fetch_flv.js
+++ b/ldrize_cooperation_fetch_flv.js
@@ -1,11 +1,11 @@
// Vimperator plugin: 'Cooperation LDRize Mappings - Niconico Flv Fetcher'
-// Version: 0.2
+// Version: 0.3
// Last Change: 03-Apr-2008. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
// Cooperation LDRize Mappings - Niconico Flv Fetcher for vimperator0.6.*
-// Require LDRize Cooperation ver 0.13
+// Require LDRize Cooperation ver 0.14
(function(){
function LDRizeCooperationNiconicoFlvFetcher(){
var NiconicoFlvFetcher = {
@@ -14,6 +14,7 @@
const nicoApiEndPoint = "http://www.nicovideo.jp/api/getflv?v=";
const nicoWatchEndPoint = "http://www.nicovideo.jp/watch/";
var videoId = url.match(/\wm\d+/)[0];
+ var fileName = title.replace(/[?\\\*\/:<>\|\"]/g,'_') + ".flv";
httpGET(nicoApiEndPoint + videoId,function(apiResult){
var flvUrl = decodeURIComponent(apiResult.match(/url=(.*?)&/)[1]);
@@ -26,10 +27,10 @@
var sourceUri = makeURI(flvUrl,null,null);
var file = DownloadManager.userDownloadsDirectory;
- file.appendRelativePath(title + ".flv");
+ file.appendRelativePath(fileName);
var fileUri = makeFileURI(file);
- var download = DownloadManager.addDownload(0, sourceUri, fileUri, title + ".flv",
+ var download = DownloadManager.addDownload(0, sourceUri, fileUri, fileName,
null, null, null, null, WebBrowserPersist);
WebBrowserPersist.progressListener = download;
WebBrowserPersist.saveURI(sourceUri, null, null, null, null, file);