-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy path瓜子H5.js
189 lines (184 loc) · 5.98 KB
/
瓜子H5.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// http://localhost:5757/api/瓜子H5?ac=list&t=1&pg=1
// http://localhost:5757/api/瓜子H5?ac=detail&ids=447
// http://localhost:5757/api/瓜子H5?wd=&pg=1
// http://localhost:5757/api/瓜子H5?play=&flag=瓜子H5
var rule = {
类型: '影视',
title: '瓜子H5',
desc: '瓜子H5纯js版本',
homeUrl:'https://api.zaqohu.com/H5',
url: '/api.php/getappapi.index/typeFilterVodList',
searchUrl: '/api.php/getappapi.index/searchList',
searchable: 2,
quickSearch: 0,
filterable: 1,
filter_url: '{{fl.class}}',
filter: '',
filter_def: {
'3': {class: ''},
'4': {class: ''},
'5': {class: ''},
'6': {class: ''},
},
headers: {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
'Content-Type': 'application/json',
},
timeout: 5000,
play_parse: true,
class_parse: async () => {
let classes = [{
type_id: '3',
type_name: '电影',
}, {
type_id: '4',
type_name: '电视剧',
}, {
type_id: '5',
type_name: '动漫'
}, {
type_id: '6',
type_name: '综艺'
}];
let filters = {}
for (const it of classes) {
const params = encrypt(JSON.stringify({'pid':parseInt(it.type_id)}))
let data = JSON.stringify({
"params": params
});
let config = {
method: 'POST',
headers: {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
'Content-Type': 'application/json',
},
data: data
};
const html = JSON.parse((await req('https://api.zaqohu.com/H5/Index/CategoryList',config)).content)
const list = JSON.parse(decrypt(html.data)).list
let values = []
list.forEach((val)=>{
values.push({
'n':val.type.trim(),
'v':val.show_id===undefined?'':val.show_id
})
})
filters[it.type_id] = [{
"key":"class",
"name":"class",
"value":values
}]
}
return {
class: classes, filters,
}
},
预处理: async () => {
return []
},
推荐: async () => {
return []
},
一级: async function (tid, pg, filter, extend) {
let {MY_CATE, input} = this;
if (pg <= 0) pg = 1;
let html = ''
let list = ''
let videos = []
if(extend.class===''||extend.class===undefined){
const params = encrypt(JSON.stringify({"pid": Number(tid), "pageSize": 24, "page": pg}))
const data =JSON.stringify({
"params": params
});
html = JSON.parse((await req(`${rule.homeUrl}/Category/GetChoiceList`, {
method:'post',
headers: rule.headers,
data:data
})).content);
list = JSON.parse(decrypt(html.data)).list
list.forEach((it)=>{
videos.push({
vod_id: it.vod_id,
vod_name:it.c_name,
vod_pic:it.c_pic
})
})
}else {
const params = encrypt(JSON.stringify({ show_id: extend.class, show_pid: Number(tid), pageSize: 24, page: pg }))
const data =JSON.stringify({
"params": params
})
html = JSON.parse((await req(`${rule.homeUrl}/Category/GetModuleList`, {
method:'post',
headers: rule.headers,
data:data,
})).content);
list = JSON.parse(decrypt(html.data)).list
list.forEach((it)=>{
videos.push({
vod_id: it.vod_id,
vod_name:it.vod_name,
vod_pic:it.vod_pic
})
})
}
return videos
},
二级: async function (ids) {
let {input} = this;
log(input)
const vod_id = {"vod_id":ids[0],"pageSize":"10000","page":"1"}
const params = encrypt(JSON.stringify(vod_id))
const data = JSON.stringify({
"params":params
})
const html = JSON.parse((await req(`${rule.homeUrl}/Resource/GetOnePlayList`, {
headers:rule.headers,
method:'post',
body:data
})).content);;
const list = JSON.parse(decrypt(html.data)).urls
const urls = []
list.forEach((it)=>{
urls.push(it.name+"$"+it.url)
})
let vod = {
vod_id: ids[0],
}
let playFroms = [];
let playUrls = []
playFroms.push('由不知道倾情打造');
vod.vod_play_from = playFroms.join('$$$');
playUrls.push(urls.join('#'));
vod.vod_play_url = playUrls.join('$$$');
return vod
},
搜索: async function (wd, quick, pg) {
},
lazy: async function (flag, id, flags) {
let {getProxyUrl,input} = this;
return {parse:0,url:id}
},
proxy_rule:async function(params){
let {input} = this;
}
};
const key = CryptoJS.enc.Utf8.parse("181cc88340ae5b2b")
const iv = CryptoJS.enc.Utf8.parse("4423d1e2773476ce")
function encrypt(data) {
return CryptoJS.AES.encrypt(data, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}).ciphertext.toString(CryptoJS.enc.Hex)
}
function decrypt(data) {
const text = CryptoJS.enc.Hex.parse(data)
return CryptoJS.AES.decrypt({
ciphertext: text
}, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}).toString(CryptoJS.enc.Utf8)
}