diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a973060..9b83fef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ ci: repos: - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.1 + rev: v3.0.0-alpha.6 hooks: - id: prettier types: [javascript] \ No newline at end of file diff --git a/ede.js b/ede.js index bf76373..44da4fb 100644 --- a/ede.js +++ b/ede.js @@ -3,7 +3,7 @@ // @description Emby弹幕插件 // @namespace https://github.com/RyoLee // @author RyoLee -// @version 1.10 +// @version 1.11 // @copyright 2022, RyoLee (https://github.com/RyoLee) // @license MIT; https://raw.githubusercontent.com/RyoLee/emby-danmaku/master/LICENSE // @icon https://github.githubassets.com/pinned-octocat.svg @@ -204,7 +204,7 @@ } console.log('正在初始化UI'); // 弹幕按钮容器div - let parent = uiAnchor[0].parentNode.parentNode; + let parent = uiAnchor[0].parentNode.parentNode.parentNode; let menubar = document.createElement('div'); menubar.id = 'danmakuCtr'; if (!window.ede.episode_info) { @@ -308,7 +308,14 @@ if (is_auto) { searchUrl += '&episode=' + episode; } - let animaInfo = await fetch(searchUrl) + let animaInfo = await fetch(searchUrl, { + method: 'GET', + headers: { + 'Accept-Encoding': 'gzip', + Accept: 'application/json', + 'User-Agent': navigator.userAgent, + }, + }) .then((response) => response.json()) .catch((error) => { console.log('查询失败:', error); @@ -348,8 +355,15 @@ } function getComments(episodeId) { - let url = 'https://api.xn--7ovq92diups1e.com/cors/https://api.dandanplay.net/api/v2/comment/' + episodeId + '?withRelated=true&chConvert=' + window.ede.chConvert; - return fetch(url) + let url = 'https://api.9-ch.com/cors/https://api.dandanplay.net/api/v2/comment/' + episodeId + '?withRelated=true&chConvert=' + window.ede.chConvert; + return fetch(url, { + method: 'GET', + headers: { + 'Accept-Encoding': 'gzip', + Accept: 'application/json', + 'User-Agent': navigator.userAgent, + }, + }) .then((response) => response.json()) .then((data) => { console.log('弹幕下载成功: ' + data.comments.length); @@ -383,7 +397,7 @@ container: _container, media: _media, comments: _comments, - engine: 'DOM', + engine: 'canvas', }); window.ede.danmakuSwitch == 1 ? window.ede.danmaku.show() : window.ede.danmaku.hide(); if (window.ede.ob) {