Skip to content

Commit

Permalink
Update ede.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Xarth-Mai authored Sep 5, 2024
1 parent 6e9e29d commit 87c44ab
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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')) {
Expand Down

0 comments on commit 87c44ab

Please sign in to comment.