From 87c44aba4cfd35586c84857d7b6d70c20ee2bd1c Mon Sep 17 00:00:00 2001 From: Xarth Date: Fri, 6 Sep 2024 00:09:45 +0800 Subject: [PATCH] Update ede.js --- ede.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/ede.js b/ede.js index a98cb58..1244461 100644 --- a/ede.js +++ b/ede.js @@ -977,20 +977,16 @@ try { let response = await makeGetRequest(url_all); let data = isInTampermonkey ? JSON.parse(response) : await response.json(); - const nonDandan = /^\[(?!BiliBili|Gamer).{3,}\]/; // 匹配其他弹幕 - let hasRelated = false; - for (const c of data.comments) { - if (nonDandan.test(c.p.split(',').pop())) { - hasRelated = true; - break; + const matchBili = /^\[BiliBili\]/; + let hasBili = false; + if ((danmakuFilter & 1) !== 1) { + for (const c of data.comments) { + if (matchBili.test(c.p.split(',').pop())) { + hasBili = true; + break; + } } } - if (hasRelated) { // 实际包含第三方弹幕 - showDebugInfo('弹幕下载成功: ' + data.comments.length); - return data.comments; - } else { - showDebugInfo('缺少第三方弹幕,尝试获取'); - } let comments = data.comments; response = await makeGetRequest(url_related); data = isInTampermonkey ? JSON.parse(response) : await response.json(); @@ -1000,7 +996,10 @@ // 根据设置过滤弹幕源 let src = []; for (const s of data.relateds) { - if ((danmakuFilter & 1) !== 1 && s.url.includes('bilibili')) { + if ((danmakuFilter & 1) !== 1 && !hasBili && s.url.includes('bilibili.com/bangumi')) { + src.push(s.url); + } + if ((danmakuFilter & 1) !== 1 && s.url.includes('bilibili.com/video')) { src.push(s.url); } if ((danmakuFilter & 2) !== 2 && s.url.includes('gamer')) {