aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stella.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/stella.js b/stella.js
index 53e9593..2596a8f 100644
--- a/stella.js
+++ b/stella.js
@@ -39,7 +39,7 @@ let PLUGIN_INFO =
<name lang="ja">すてら</name>
<description>For Niconico/YouTube/Vimeo, Add control commands and information display(on status line).</description>
<description lang="ja">ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。</description>
- <version>0.26.5</version>
+ <version>0.26.6</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
@@ -809,6 +809,7 @@ Thanks:
}
YouTubePlayer.getIDfromURL = function (url) let ([_, r] = url.match(/[?;&]v=([-\w]+)/)) r;
+ YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url);
YouTubePlayer.OUTER_NODES = [
'old-masthead',
@@ -924,9 +925,12 @@ Thanks:
let result = [];
let doc = content.document;
for each (let item in Array.slice(doc.querySelectorAll('.video-list-item'))) {
+ let url = item.querySelector('a').href;
+ if (!YouTubePlayer.isVideoURL(url))
+ continue;
result.push(
new RelatedID(
- YouTubePlayer.getIDfromURL(item.querySelector('a').href),
+ YouTubePlayer.getIDfromURL(url),
item.querySelector('span.title').textContent,
item.querySelector('img').src
)