-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy path牛牛短剧.js
More file actions
229 lines (210 loc) · 6.78 KB
/
牛牛短剧.js
File metadata and controls
229 lines (210 loc) · 6.78 KB
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
@header({
searchable: 2,
filterable: 1,
quickSearch: 0,
title: '牛牛短句[短]',
'类型': '影视',
lang: 'ds'
})
*/
var rule = {
title: '牛牛短句[短]',
host: 'https://new.tianjinzhitongdaohe.com',
homeUrl: '/api/v1/app/screen/screenType',
searchUrl: '/api/v1/app/search/searchMovie',
url: '/api/v1/app/screen/screenMovie?classify=fyclass&page=fypage',
headers: {
"Cache-Control": "no-cache",
"Content-Type": "application/json;charset=UTF-8",
"User-Agent": "okhttp/4.12.0"
},
timeout: 5000,
filterable: 1,
limit: 40,
multi: 1,
searchable: 2,
play_parse: true,
search_match: true,
class_parse: async function () {
const url = `${rule.host}/api/v1/app/screen/screenType`;
try {
const response = await request(url, {
method: 'POST',
headers: rule.headers
});
const data = JSON.parse(response);
const classes = [];
if (data.data && data.data[0]?.children?.[0]?.children) {
data.data[0].children[0].children.forEach(vod => {
classes.push({
type_name: `${vod.name}`,
type_id: vod.name
});
});
}
return {
class: classes,
filters: {}
};
} catch (e) {
console.error("分类解析错误:", e);
return {class: []};
}
},
一级: async function () {
const {input, MY_PAGE} = this;
const cid = input.split('classify=')[1].split('&')[0];
const page = MY_PAGE || 1;
const payload = JSON.stringify({
condition: {
classify: cid,
typeId: "S1"
},
pageNum: String(page),
pageSize: rule.limit
});
try {
const url = `${rule.host}/api/v1/app/screen/screenMovie`;
const response = await request(url, {
method: 'POST',
headers: rule.headers,
body: payload
});
const data = JSON.parse(response);
const videos = [];
if (data.data?.records) {
data.data.records.forEach(vod => {
videos.push({
title: vod.name,
img: vod.cover,
desc: `${vod.totalEpisode}集`,
url: vod.id
});
});
}
return setResult(videos);
} catch (e) {
console.error("一级列表错误:", e);
return [];
}
},
二级: async function () {
const { orId } = this;
let did = orId;
let bofang = '';
let xianlu = '';
let content = '';
try {
// 获取剧集列表
const detailPayload = JSON.stringify({
id: did,
source: 0,
typeId: "S1",
userId: "223664"
});
const detailUrl = `${rule.host}/api/v1/app/play/movieDetails`;
const detailResponse = await request(detailUrl, {
method: 'POST',
headers: rule.headers,
body: detailPayload
});
const detailData = JSON.parse(detailResponse).data || {};
if (detailData.episodeList && detailData.episodeList.length > 0) {
const episodes = detailData.episodeList.map(ep => {
return `${ep.episode}$${did}@${ep.id}`;
});
bofang = episodes.join('#');
xianlu = '牛牛短句';
content = detailData.introduce || '暂无剧情介绍';
}
return {
vod_name: detailData.name || '未知名称',
vod_pic: detailData.cover || '',
vod_content: content,
vod_play_from: xianlu || '暂无资源',
vod_play_url: bofang || '暂无播放地址$0'
};
} catch (e) {
console.error("详情解析错误:", e);
return {
vod_name: '加载失败',
vod_pic: '',
vod_content: '详情加载失败,请稍后重试',
vod_play_from: '暂无资源',
vod_play_url: '暂无播放地址$0'
};
}
},
搜索: async function () {
const {KEY, MY_PAGE} = this;
const page = MY_PAGE || 1;
const payload = JSON.stringify({
condition: {
typeId: "S1",
value: KEY
},
pageNum: String(page),
pageSize: rule.limit
});
try {
const url = `${rule.host}/api/v1/app/search/searchMovie`;
const response = await request(url, {
method: 'POST',
headers: rule.headers,
body: payload
});
const data = JSON.parse(response);
const videos = [];
if (data.data?.records) {
data.data.records.forEach(vod => {
if (rule.search_match && !vod.name.includes(KEY)) return;
videos.push({
title: vod.name,
img: vod.cover,
desc: `更新时间${vod.year || '未知'}`,
url: vod.id
});
});
}
return setResult(videos);
} catch (e) {
console.error("搜索错误:", e);
return [];
}
},
lazy: async function () {
const {input} = this;
const [videoId, episodeId] = input.split('@');
const payload = JSON.stringify({
episodeId,
id: videoId,
source: 0,
typeId: "S1",
userId: "223664"
});
try {
const url = `${rule.host}/api/v1/app/play/movieDetails`;
const response = await request(url, {
method: 'POST',
headers: rule.headers,
body: payload
});
const data = JSON.parse(response);
return {
parse: 0,
url: data.data?.url || '',
header: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36'
}
};
} catch (e) {
console.error("播放地址获取错误:", e);
return {
parse: 0,
url: '',
header: {}
};
}
}
};