mirror of
https://github.com/fireinrain/JHS-enhance.git
synced 2026-10-10 20:06:36 +08:00
移除javxy的接口依赖
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
const COVER_API_URL = [77, 81, 81, 85, 86, 31, 10, 10, 68, 85, 76, 8, 65, 72, 72, 87, 86, 70, 11, 20, 22, 20, 17, 22, 22, 11, 93, 92, 95, 10, 68, 85, 76, 10, 70, 74, 83, 64, 87]
|
||||||
|
.map(v => String.fromCharCode(v ^ 0x25)).join('');
|
||||||
|
|
||||||
|
const COVER_API_TOKEN = [18, 28, 19, 19, 65, 65, 70, 28, 64, 29, 23, 21, 17, 29, 67, 70, 18, 64, 21, 22, 64, 16, 65, 29, 22, 19, 16, 28, 16, 17, 64, 29]
|
||||||
|
.map(v => String.fromCharCode(v ^ 0x25)).join('');
|
||||||
|
|
||||||
|
const getCover = async (code) => {
|
||||||
|
const query = String(code || '').trim();
|
||||||
|
if (!query) return null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const r = await gmHttp.get(`${COVER_API_URL}/${encodeURIComponent(query)}`, null, {
|
||||||
|
'Authorization': `Bearer ${COVER_API_TOKEN}`,
|
||||||
|
}, {timeout: 15000});
|
||||||
|
|
||||||
|
if (r?.cover?.large) {
|
||||||
|
//clog.log('高清封面地址:', r.cover.large);
|
||||||
|
return r.cover.large;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (e) {
|
||||||
|
clog.error('获取封面失败:', e.message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export {getCover};
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
} from '../core/constants.js';
|
} from '../core/constants.js';
|
||||||
import { HotkeyManager } from './preview-video.js';
|
import { HotkeyManager } from './preview-video.js';
|
||||||
import {GM_xmlhttpRequest} from 'vite-plugin-monkey/dist/client';
|
import {GM_xmlhttpRequest} from 'vite-plugin-monkey/dist/client';
|
||||||
import {getJavxyCover} from '../api/javxy.js';
|
import {getCover} from '../api/cover.js';
|
||||||
|
|
||||||
class DetailPageButtonPlugin extends BasePlugin {
|
class DetailPageButtonPlugin extends BasePlugin {
|
||||||
getName() {
|
getName() {
|
||||||
@@ -108,14 +108,9 @@ class DetailPageButtonPlugin extends BasePlugin {
|
|||||||
const $btn = $("#downloadCoverBtn");
|
const $btn = $("#downloadCoverBtn");
|
||||||
$btn.addClass("is-loading").prop("disabled", true);
|
$btn.addClass("is-loading").prop("disabled", true);
|
||||||
try {
|
try {
|
||||||
const coverData = await getJavxyCover(carNum2);
|
const coverUrl = await getCover(carNum2);
|
||||||
if (!coverData) {
|
|
||||||
show.error("未找到高清封面");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const coverUrl = coverData.url || coverData.highCover || coverData.cover;
|
|
||||||
if (!coverUrl) {
|
if (!coverUrl) {
|
||||||
show.error("封面链接为空");
|
show.error("未找到高清封面");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fileName = `${carNum2}-cover.jpg`;
|
const fileName = `${carNum2}-cover.jpg`;
|
||||||
|
|||||||
Reference in New Issue
Block a user