Skip to content

Commit

Permalink
Merge pull request #37 from RyoLee/develop
Browse files Browse the repository at this point in the history
v1.11
  • Loading branch information
RyoLee authored Apr 9, 2023
2 parents fe0ef58 + af7133d commit ffba6ec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
26 changes: 20 additions & 6 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ffba6ec

Please sign in to comment.