-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy path菜狗[官].js
More file actions
200 lines (196 loc) · 9.94 KB
/
菜狗[官].js
File metadata and controls
200 lines (196 loc) · 9.94 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
/*
@header({
searchable: 2,
filterable: 1,
quickSearch: 0,
title: '菜狗[官]',
'类型': '影视',
lang: 'ds'
})
*/
var rule = {
title: '菜狗[官]',
host: 'https://waptv.sogou.com',
homeUrl: '',
searchUrl: '/film/result?ie=utf8&query=**',
searchable: 2,
quickSearch: 0,
filterable: 1,
multi: 1,
// 分类链接fypage参数支持1个()表达式
url: '/napi/video/classlist?abtest=0&iploc=CN1304&spver=&listTab=fyclass&filter=&start=((fypage-1)*15)&len=15&fr=filter',
filter_url: 'style={{fl.style}}&zone={{fl.zone}}&year={{fl.year}}&fee={{fl.fee}}&order={{fl.order}}',
headers: {
'User-Agent': 'PC_UA'
},
timeout: 5000,
class_name: '电视剧&电影&动漫&综艺&纪录片',
class_url: 'teleplay&film&cartoon&tvshow&documentary',
filter: 'H4sIAAAAAAAAA+2Y3VIiRxTH34VrL9TsV/Iqqb2g3NlKKiopl92U2bIKQRRQASkXMXyqiygrOiCyMID7MtM9w1tkmO5zTpuLyVxYayrFFfz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PcZCdjOaLJrOAhLoDjjztMYpwt0QYjzLRhPAhWKnjMbWChcwMRms7wBp0AJfgTY68DOcy2eAlGXQFuto1wQBCiFkH86pkI4hSc+zHsd2B0dd47pJOpT8CXq//Iq2sqSqje8kOaFqs93McefrCjclSRQWnJ2t8yuNzEzwJiA9K7ValtnKcgBMsY+qlnDfZaA3UKMm6KzyTaxogtQ+jf7eV45ov4lY/+Rpp3dh84FYPztJu/dQfACcHsncmwbCqwEjGjsXLPLkxzUUWKM63jMOpe8DIkmVpYt7zat8wGtXMkYufHVvofbtAQ6AdVMA05xErBdouD0xKPn0BQZn9BHvDYyBzrPgBA9MOF75tq88gVeUoAyCrts0BBTwLm7u2Nf4XwmAX36KbuAc5aEp603b0JL71e01XBw7bE+3Xt99rZ3mtZWD95fgHIGtZJ46heAGf98b45gk0jAPerxHcSpdjyPVV4AXcp32B5+OxJAGlY0jV3UMBdUWU1hRRWgjEfvIAHHS59a3VMYT4Cv8nYUt0/2qExNQemTbkoSnljiZ99rZreF2W3hu6j3xt+Cxnoedx0AAA==',
limit: 20,
play_parse: true,
play_json: 1,
lazy: async function () {
let {input, fetch_params} = this;
fetch_params.headers["User-Agent"] = MOBILE_UA;
let html = await request(input, fetch_params);
let rurl = html.match(/window\.open\('(.*?)',/)[1];
rurl = urlDeal(rurl);
return {parse: 1, jx: 1, url: rurl};
},
一级: async function () {
let {input} = this;
let d = [];
let html = await request(input);
html = JSON.parse(html);
let list = html.listData.results;
list.forEach(function (it) {
let desc1 = it.ipad_play_for_list.finish_episode ? it.ipad_play_for_list.episode === it.ipad_play_for_list.finish_episode ? "全集" + it.ipad_play_for_list.finish_episode : "连载" + it.ipad_play_for_list.episode + "/" + it.ipad_play_for_list.finish_episode : "";
let desc2 = it.score ? "评分:" + it.score : "";
let desc3 = it.date ? "更至:" + it.date : "";
d.push({
title: it.name,
img: it.v_picurl,
url: "https://v.sogou.com" + it.url.replace("teleplay", "series").replace("cartoon", "series"),
desc: desc1 || desc2 || desc3
})
});
return setResult(d);
},
二级: async function () {
let {input,pd} = this;
log('input:', input);
let VOD = {};
let html = await request(input);
try {
let json = JSON.parse(html.match(/INITIAL_STATE.*?({.*});/)[1]).detail.itemData;
let key = json.dockey;
let name = json.name;
let zone = json.zone;
let score = json.score ? json.score : "暂无";
let style = json.style;
let emcee = json.emcee ? "主持:" + json.emcee : json.name;
let director = json.director ? "导演:" + json.director : name;
director = director.replace(/;/g, "\\t");
let starring = json.starring ? "演员:" + json.starring : "声优:" + json.shengyou;
starring = starring.replace(/.*undefined/, "").replace(/;/g, "\\t");
let update = json.update_wordstr ? json.update_wordstr : "";
let tv_station = json.tv_station ? json.tv_station : zone;
let introduction = json.introduction;
let shengyou = json.shengyou;
let shows = json.play_from_open_index;
let plays = json.play.item_list;
if (shows) {
VOD.vod_name = name;
VOD.vod_area = emcee + "," + tv_station;
VOD.vod_director = director;
VOD.vod_actor = starring;
VOD.vod_pic = pd(html, "#thumb_img&&img&&src");
VOD.vod_remarks = style + " 评分:" + score + "," + update;
VOD.vod_content = introduction
} else {
VOD.vod_name = name;
VOD.vod_director = director;
VOD.vod_actor = starring;
VOD.vod_pic = pd(html, "#thumb_img&&img&&src");
VOD.vod_content = introduction
}
log('vod:',VOD);
let tp = "&type=json";
try {
let tabs = [];
let lists = [];
plays.forEach(function (it) {
lists.push(it.info);
let tbn = it.sitename[0] || it.site.replace(".com", "");
tbn = tbn.split("").join(" ");
tabs.push(tbn)
});
VOD.vod_play_from = tabs.join("$$$");
let vod_lists = [];
let play_url = '';
print("play_url1:" + play_url);
play_url = play_url.replace("&play_url=", "&type=json&play_url=");
print("play_url2:" + play_url);
lists.forEach(function (item, idex) {
if (item || shows) {
if (item && Array.isArray(item) && item.length > 1) {
let tmp = item.slice(1).map(function (its) {
return its.index + "$" + play_url + base64Encode(adhead(its.url))
});
vod_lists.push(tmp.join("#"))
}
if (shows) {
let arr = [];
let tmp = [];
let zy = shows.item_list[idex];
zy.date.forEach(function (date) {
let day = date.day;
for (let j = 0; j < day.length; j++) {
let dayy = day[j][0] >= 10 ? day[j][0] : "0" + day[j][0];
let Tdate = date.year + date.month + dayy;
arr.push(Tdate)
}
});
for (let k = 0; k < arr.length; k++) {
let url = "https://v.sogou.com/vc/eplay?query=" + arr[k] + "&date=" + arr[k] + "&key=" + key + "&st=5&tvsite=" + plays[idex].site;
tmp.push("第" + arr[k] + "期" + "$" + play_url + base64Encode(adhead(url)))
}
vod_lists.push(tmp.join("#"))
}
} else if (plays[idex].site) {
let tmp = [];
if (!plays[idex].flag_list.includes("trailer")) {
tmp.push(plays[idex].sitename[0] + "$" + play_url + base64Encode(adhead(plays[idex].url)))
} else {
tmp.push(plays[idex].sitename[0] + "—预告" + "$" + play_url + base64Encode(adhead(plays[idex].url)))
}
vod_lists.push(tmp.join("#"))
}
});
VOD.vod_play_url = vod_lists.join("$$$")
} catch (e) {
let img = json.photo.item_list;
VOD.vod_name = "本片无选集";
VOD.vod_pic = img.length > 0 ? img[0] : ""
}
} catch (e) {
print("发生了错误:" + e.message)
}
return VOD
},
搜索: async function () {
let {input} = this;
let d = [];
let html = await request(input);
let jsonA = JSON.parse(html.match(/INITIAL_STATE.*?({.*});/)[1]);
print(jsonA);
jsonA = jsonA.result.resultData.searchData.results;
jsonA.forEach(function (it) {
let name = it.name;
let introduction = it.introduction;
let pic = it.v_picurl;
let url = it.tiny_url;
let zone = it.zone;
let score = it.score || "暂无";
let style = it.style;
if (it.play_info && it.play_info.play_list) {
let r = {};
r.title = name.replace(//, "").replace(//, "");
r.url = "https://v.sogou.com" + url.replace(/teleplay|cartoon/g, 'series');
r.desc = it.listCategory.join(",");
r.content = introduction;
r.pic_url = pic;
d.push(r)
}
});
return setResult(d);
},
}
function adhead(url) {
let hd = "https://v.sogou.com";
if (!url.startsWith(hd)) {
url = hd + url
}
return urlencode(url)
}