forked from qist/tvbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dovx_open.js
81 lines (71 loc) · 1.91 KB
/
dovx_open.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { _ } from 'assets://js/lib/cat.js';
import { log } from './lib/utils.js';
import { initAli, detailContent, playContent } from './lib/ali.js';
let siteKey = 'dovx';
let siteType = 0;
let siteUrl = 'https://api.dovx.tk';
let patternAli = /(https:\/\/www\.aliyundrive\.com\/s\/[^"]+)/
async function request(reqUrl) {
let res = await req(reqUrl, {
method: 'get',
headers: {
'Referer': siteUrl,
},
});
return res.content;
}
// cfg = {skey: siteKey, ext: extend}
async function init(cfg) {
try {
siteKey = _.isEmpty(cfg.skey) ? '' : cfg.skey;
siteType = _.isEmpty(cfg.stype) ? '' : cfg.stype;
await initAli(cfg);
} catch (e) {
await log('init:' + e.message + ' line:' + e.lineNumber);
}
}
async function home(filter) {
return '{}';
}
async function homeVod() {}
async function category(tid, pg, filter, extend) {
return '{}';
}
async function detail(id) {
try {
let matches = id.match(patternAli);
if (!_.isEmpty(matches)) return await detailContent(matches[0]);
return '';
} catch (e) {
await log('detail:' + e.message + ' line:' + e.lineNumber);
}
}
async function play(flag, id, flags) {
try {
return await playContent(flag, id, flags);
} catch (e) {
await log('play:' + e.message + ' line:' + e.lineNumber);
}
}
async function search(wd, quick, pg) {
let resp = await request(siteUrl + "/ali/search?wd=" + encodeURIComponent(wd));
let videos = JSON.parse(resp).list;
_.each(videos, (item) => {
item.vod_id = item.vod_content;
item.vod_content = undefined;
});
return JSON.stringify({
list: videos,
});
}
export function __jsEvalReturn() {
return {
init: init,
home: home,
homeVod: homeVod,
category: category,
detail: detail,
play: play,
search: search,
};
}