-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
61 lines (53 loc) · 1.58 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* #name VIP视频解析
* #description 各种VIP视频解析
* #icon ../vip.png
* #version 1.0.0
*/
import { notify, swal, q, BMScript } from '#/utils';
import { handleDefineError } from '#/utils/error';
import vipJson from './vip.json';
const script = BMScript.init({
match: [
/\w+:\/\/\w+.iqiyi.com/ig,
/\w+:\/\/\w+.youku.com/ig,
/\w+:\/\/\w+.le.com/ig,
/\w+:\/\/\w+.letv.com/ig,
/\w+:\/\/v.qq.com/ig,
/\w+:\/\/\w+.tudou.com/ig,
/\w+:\/\/\w+.mgtv.com/ig,
/\w+:\/\/film.sohu.com/ig,
/\w+:\/\/tv.sohu.com/ig,
/\w+:\/\/\w+.acfun.cn\/v/ig,
/\w+:\/\/\w+.bilibili.com/ig,
/\w+:\/\/vip.1905.com\/play/ig,
/\w+:\/\/\w+.pptv.com/ig,
/\w+:\/\/\w+.wasu.cn\/Play\/show/ig,
/\w+:\/\/\w+.56.com/ig,
]
});
script.run(async () => {
const { value: config, isConfirmed } = await swal.fire({
title: '选择解析接口',
html: `<div>
<select id="select-api" class='swal2-select'>
${vipJson.map((vip, index) => `<option ${index == 0 ? 'selected' : ''} value="${vip.api}">${vip.name}</option>`)}
</select>
</div>`,
width: 420,
focusConfirm: false,
confirmButtonText: '确定',
preConfirm: () => {
const selectApi = q<HTMLSelectElement>('#select-api')!;
const selectApiValue = selectApi.options[selectApi.selectedIndex].value;
return {
selectApiValue
};
},
});
if (!isConfirmed) {
notify.warning('已取消!');
return;
}
window.open(config.selectApiValue.replace('%url%', window.location.href));
}).catch(handleDefineError);