6/tvbox/xiaosa/lib/优酷视频.js

175 lines
13 KiB
JavaScript

var rule = {
title: '优酷[官]',
host: 'https://www.%79%6f%75%6b%75.com',
homeUrl: '',
searchUrl: 'https://search.%79%6f%75%6b%75.com/api/search?pg=fypage&keyword=**',
searchable: 2,
quickSearch: 0,
filterable: 1,
multi: 1,
url: '/category/data?optionRefresh=1&pageNo=fypage&params=fyfilter',
filter_url: '{{fl}}',
filter: 'H4sIAAAAAAAAA+1cW28bu7X+K4Uf+lIFsHJ3Hw7Q3d1TbODgtA9FgYODDUNJdLKNJs6u46RIiw3IF9nyRfJNtiVLjnyRLd9081UaWdKfGXJm/sXhDMm1SElWnGxnuwECGE6+tTgccpFc6+Mix//qseJndm6CTOV6fvu//+r5W/Bdz297XgYGBvsDQ8FAj69nMPAyyEQkvOeM7ZF0icwaTPo28OJN0HtisIOSiXp+8gndRNhVsPq5wqzkSarOpVCIVoqtJZzdJJNiNXPtdcyVaLUBJZzMPpZwQaoOOqsRQ50LFJ09U0adCxQdXd1BHQM0fYS6E6VFLnCf+97VciMOB56/brWfVa6R9zNX2A+Vqv2c9UWa2JHd4gCNkrW3w0InAHQ5UqZjUicA1DlWJ5VRWScHUOdKGrvFgY/Ov7eOFrDnkYRpTMmec4DDnaKr0CQOwNKlKCstLc0BPDdyTsbm5HMcwHP5XTJ7IJ/jAN+36CT34X0eABPsN+3zaWkCDqTOrCXNxoacTxxA//K7qBMAdKNH1sqC1HEA76sf0M2IfB8H0M7COTHysp0cgC42QeaOpY4D0FVPzdq21HGAfU/T9QXouwfUGfguGBhqW8FuFfWrVjAo1Rl4t/fufSHz/qvI76H8niq/i/K7qtyPcr8q70V5ryL394Gc/VeRP0b5Y1X+COWPVPlDlD9U5Q9Q/kCV37/DfmFj/X4XY89p6pSuyknnqno1u78eDgy/aVv7dm6cblxeYXlUar4zvGfVF6yZI7oopw6azbxMOOELe/KARM5lS/HJi2NSmLVqS0KDo0OiJ6Q0YVamLaMplNgxK5PHxf9A69SPgXf9w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u33g4J+9/0QYVH5x8cQa9qROMYgGvmAgAXvr8BHUCQMvm1Kspc9qllN9/8zuhcP8HXndxySnLczoBvogZIr52uv0Z0mU2fOarLy26D18xvu6fpuj6Jyc+kAh7+eb1wNN+b190Q1dj6GWcxMvKB2CAZYkXA2+DVqxEgKspApjoWyNkZ4WEK1YWprsqguXV5XM7Ui+7x1OxDH7hpongXd7c5GkM+S5VpJdjTA/ZkSbSy7X+HYVWqV765VutGIMtrVM/TtJEX8TyF18d3v7y/8gA8Zy1rf/JUGDwWWtDP4Gvut+/hMJ2dNsOwZGvKoL2LM6S6ol13LBn4NNyVYQbret9um03L8z6hvZptCaC8YssWGvj+ifUqgjKZaPW1D7bD9BIgoydkRIcUrcrcHPh5udZq0g+YTdT6ta2TQH9OzoyjThbgfjJniaCcrOHzD52aMS5lH/rRRPBStple7QNetogRTnamgjq8/4wmvs1OsxjTQR29S612iNxKwUnEaroMzAN+2zcLsDOnwPQ5bbtoswpCIChpIarQQAYmuOklVqUw8EBmKLLpTo+ZlLHAerO3Nyn+kWaJoKpHl1mW3S3QRAMNBHUx//IAJw3IoaautzItFIJa7QKvfAA9J5/VqFlW1SRXk5b2JoIRqE4Ts/kuAkAbSyNk0loIwfQxjxbY5CP4QCe63Z9MXpCV8/ZgsOnNRGW27Sm4FYqBzhzFu2pYzpVUL509ET/IWRfQIz56f8BvNNeN7lTAAA=',
headers: {
'User-Agent': 'PC_UA',
'Cookie': 'cna=VvNvGX3e0ywCAavVEXlnA2bg; __ysuid=1626676228345Rl1; __ayft=1652434048647; __arycid=dm-1-00; __arcms=dm-1-00; __ayvstp=85; __arpvid=1667204023100cWWdgM-1667204023112; __ayscnt=10; __aypstp=60; isg=BBwcqxvvk3BxkWQGugbLpUSf7TrOlcC_U7GAj_YdfYfvQbzLHqYGT4Hgp6m5TvgX; tfstk=c3JOByYUH20ilVucLOhh0pCtE40lZfGc-PjLHLLfuX7SWNyAiQvkeMBsIw7PWDC..; l=eBQguS-PjdJFGJT-BOfwourza77OSIRA_uPzaNbMiOCPOb1B5UxfW6yHp4T6C3GVhsGJR3rp2umHBeYBqQd-nxvOF8qmSVDmn',
'Referer': 'https://www.youku.com',
},
timeout: 5000,
class_name: '电视剧&电影&综艺&动漫&少儿&纪录片&文化&亲子&教育&搞笑&生活&体育&音乐&游戏',
class_url: '电视剧&电影&综艺&动漫&少儿&纪录片&文化&亲子&教育&搞笑&生活&体育&音乐&游戏',
limit: 20,
play_parse: true,
lazy: $js.toString(() => {
input = {
parse: 1,
jx: 1,
url: input
};
}),
一级: $js.toString(() => {
let d = [];
MY_FL.type = MY_CATE;
let fl = stringify(MY_FL);
fl = encodeUrl(fl);
input = input.split("{")[0] + fl;
if (MY_PAGE > 1) {
let old_session = getItem("yk_session_" + MY_CATE, "{}");
if (MY_PAGE === 2) {
input = input.replace("optionRefresh=1", "session=" + encodeUrl(old_session))
} else {
input = input.replace("optionRefresh=1", "session=" + encodeUrl(old_session))
}
}
let html = fetch(input, fetch_params);
try {
html = JSON.parse(html);
let lists = html.data.filterData.listData;
let session = html.data.filterData.session;
session = stringify(session);
if (session !== getItem("yk_session_" + MY_CATE, "{}")) {
setItem("yk_session_" + MY_CATE, session)
}
lists.forEach(function (it) {
let vid;
if (it.videoLink.includes("id_")) {
vid = it.videoLink.split("id_")[1].split(".html")[0]
} else {
vid = "msearch:"
}
d.push({
title: it.title,
img: it.img,
desc: it.summary,
url: "https://search.youku.com/api/search?appScene=show_episode&showIds=" + vid,
content: it.subTitle
})
})
} catch (e) {
log("一级列表解析发生错误:" + e.message)
}
setResult(d);
}),
二级: $js.toString(() => {
var d = [];
VOD = {};
let html = request(input);
let json = JSON.parse(html);
if (/keyword/.test(input)) {
input = "https://search.youku.com/api/search?appScene=show_episode&showIds=" + json.pageComponentList[0].commonData.showId;
json = JSON.parse(fetch(MY_URL, fetch_params))
}
let video_lists = json.serisesList;
var name = json.sourceName;
if (/优酷/.test(name) && video_lists.length > 0) {
let ourl = "https://v.youku.com/v_show/id_" + video_lists[0].videoId + ".html";
let _img = video_lists[0].thumbUrl;
let html = fetch(ourl, {
headers: {
Referer: "https://v.youku.com/",
"User-Agent": PC_UA
}
});
let json = /__INITIAL_DATA__/.test(html) ? html.split("window.__INITIAL_DATA__ =")[1].split(";")[0] : "{}";
if (json === "{}") {
log("触发了优酷人机验证");
VOD.vod_remarks = ourl;
VOD.vod_pic = _img;
VOD.vod_name = video_lists[0].title.replace(/(\d+)/g, "");
VOD.vod_content = "触发了优酷人机验证,本次未获取详情,但不影响播放(" + ourl + ")"
} else {
try {
json = JSON.parse(json);
let data = json.data.data;
let data_extra = data.data.extra;
let img = data_extra.showImgV;
let model = json.data.model;
let m = model.detail.data.nodes[0].nodes[0].nodes[0].data;
let _type = m.showGenre;
let _desc = m.updateInfo || m.subtitle;
let JJ = m.desc;
let _title = m.introTitle;
VOD.vod_pic = img;
VOD.vod_name = _title;
VOD.vod_type = _type;
VOD.vod_remarks = _desc;
VOD.vod_content = JJ
} catch (e) {
log("海报渲染发生错误:" + e.message);
print(json);
VOD.vod_remarks = name
}
}
}
if (!/优酷/.test(name)) {
VOD.vod_content = "非自家播放源,暂无视频简介及海报";
VOD.vod_remarks = name
}
function adhead(url) {
return urlencode(url)
}
play_url = play_url.replace("&play_url=", "&type=json&play_url=");
video_lists.forEach(function (it) {
let url = "https://v.youku.com/v_show/id_" + it.videoId + ".html";
if (it.thumbUrl) {
d.push({
desc: it.showVideoStage ? it.showVideoStage.replace("期", "集") : it.displayName,
pic_url: it.thumbUrl,
title: it.title,
url: play_url + adhead(url)
})
} else if (name !== "优酷") {
d.push({
title: it.displayName ? it.displayName : it.title,
url: play_url + adhead(it.url)
})
}
});
VOD.vod_play_from = name;
VOD.vod_play_url = d.map(function (it) {
return it.title + "$" + it.url
})
.join("#");
}),
搜索: $js.toString(() => {
var d = [];
let html = request(input);
let json = JSON.parse(html);
json.pageComponentList.forEach(function (it) {
if (it.hasOwnProperty("commonData")) {
it = it.commonData;
d.push({
title: it.titleDTO.displayName,
img: it.posterDTO.vThumbUrl,
desc: it.stripeBottom,
content: it.updateNotice + " " + it.feature,
url: "https://search.youku.com/api/search?appScene=show_episode&showIds=" + it.showId + "&appCaller=h5"
})
}
});
setResult(d)
}),
}