From 13e409f466f7f461ae361f8c6747fe2c80646eff Mon Sep 17 00:00:00 2001
From: anekos
Date: Fri, 6 Feb 2009 14:49:13 +0000
Subject: オススメ動画の API
取得に失敗したときは、キャッシュに詰めないようにした。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@29655 d0d07461-0603-4401-acd4-de1884942a52
---
stella.js | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/stella.js b/stella.js
index d74909d..442727a 100644
--- a/stella.js
+++ b/stella.js
@@ -39,7 +39,7 @@ let PLUGIN_INFO =
すてら
Show video informations on the status line.
ステータスラインに動画の再生時間などを表示する。
- 0.19.3
+ 0.19.4
anekos
new BSD License (Please read the source code comments of this plugin)
修正BSDライセンス (ソースコードのコメントを参照してください)
@@ -972,12 +972,12 @@ Thanks:
get relatedIDs () {
if (this.__rid_last_url == U.currentURL())
return this.__rid_cache || [];
- this.__rid_last_url = U.currentURL();
let videos = [];
+ let failed = false;
// API で取得
- {
+ try {
let uri = 'http://www.nicovideo.jp/api/getrelation?sort=p&order=d&video=' + this.id;
let xhr = new XMLHttpRequest();
xhr.open('GET', uri, false);
@@ -991,6 +991,9 @@ Thanks:
video[c.nodeName] = c.textContent;
videos.push(new RelatedID(video.url.replace(/^.+?\/watch\//, ''), video.title));
}
+ } catch (e) {
+ liberator.log(e)
+ failed = true;
}
// コメント欄からそれっぽいのを取得する
@@ -1009,7 +1012,12 @@ Thanks:
});
}
- return this.__rid_cache = videos;
+ if (!failed) {
+ this.__rid_last_url = U.currentURL();
+ this.__rid_cache = videos;
+ }
+
+ return videos;
},
get relatedTags() {
--
cgit v1.2.3