From 5bc6e3fc87ff4dc3a9407c74e661106ce7909f0d Mon Sep 17 00:00:00 2001 From: qist <87984115@qq.com> Date: Wed, 13 Sep 2023 10:37:49 +0800 Subject: [PATCH] fix --- cat/js/AppYsV2.js | 894 ++++++++++++++++++++++++++++++++++++++++++++++ js/libvio.js | 137 +++++++ 2 files changed, 1031 insertions(+) create mode 100644 cat/js/AppYsV2.js create mode 100644 js/libvio.js diff --git a/cat/js/AppYsV2.js b/cat/js/AppYsV2.js new file mode 100644 index 00000000..e0243f6d --- /dev/null +++ b/cat/js/AppYsV2.js @@ -0,0 +1,894 @@ +import { Crypto, _ } from 'assets://js/lib/cat.js' + +let host = ''; +let header = { + 'User-Agent': 'okhttp/3.12.11' +}; +let siteKey = ''; +let siteType = ''; +let siteJx = ''; + +const urlPattern1 = /api\.php\/.*?\/vod/; +const urlPattern2 = /api\.php\/.+?\.vod/; +const parsePattern = /\/.+\\?.+=/; +const parsePattern1 = /.*(url|v|vid|php\?id)=/; +const parsePattern2 = /https?:\/\/[^\/]*/; + +const htmlVideoKeyMatch = [ + /player=new/, + /
0) { + const result = await getFinalVideo(flag, parseUrls, id); + if (result !== null) { + return JSON.stringify(result); + } + } + + if (isVideo(id)) { + const result = { + parse: 0, + playUrl: "", + url: id + }; + return JSON.stringify(result); + } else { + const result = { + parse: 1, + jx: "1", + url: id + }; + return JSON.stringify(result); + } + } catch (e) { + // Handle any error here + } + return ""; +} + +async function search(key, quick) { + try { + const apiUrl = host; + const url = getSearchUrl(apiUrl, encodeURIComponent(key)); + const json = await request(url, getHeaders(url)); + const obj = JSON.parse(json); + let jsonArray = null; + const videos = []; + + if (obj.list instanceof Array) { + jsonArray = obj.list; + } else if (obj.data instanceof Object && obj.data.list instanceof Array) { + jsonArray = obj.data.list; + } else if (obj.data instanceof Array) { + jsonArray = obj.data; + } + + if (jsonArray !== null) { + for (const vObj of jsonArray) { + if (vObj.vod_id) { + const v = { + vod_id: vObj.vod_id, + vod_name: vObj.vod_name, + vod_pic: vObj.vod_pic, + vod_remarks: vObj.vod_remarks + }; + videos.push(v); + } else { + const v = { + vod_id: vObj.nextlink, + vod_name: vObj.title, + vod_pic: vObj.pic, + vod_remarks: vObj.state + }; + videos.push(v); + } + } + } + + const result = { list: videos }; + return JSON.stringify(result); + } catch (error) { + + } + return ""; +} + + + +async function getFinalVideo(flag, parseUrls, url) { + let htmlPlayUrl = ""; + for (const parseUrl of parseUrls) { + if (parseUrl === "" || parseUrl === "null") { + continue; + } + const playUrl = parseUrl + url; + const content = await request(playUrl, null, 10000); // 10秒请求,能更好过滤webjx + let tryJson = null; + try { + tryJson = jsonParse(url, content); + } catch (error) { } + + if (tryJson !== null && tryJson.hasOwnProperty("url") && tryJson.hasOwnProperty("header")) { + tryJson.header = JSON.stringify(tryJson.header); + return tryJson; + } + + if (content.includes(" 0) { + headers["User-Agent"] = " " + ua; + } + + let referer = ""; + if (jsonPlayData.hasOwnProperty("referer")) { + referer = jsonPlayData.referer; + } else if (jsonPlayData.hasOwnProperty("Referer")) { + referer = jsonPlayData.Referer; + } + if (referer.trim().length > 0) { + headers["Referer"] = " " + referer; + } + + headers = fixJsonVodHeader(headers, input, url); + + const taskResult = { + header: headers, + url: url, + parse: "0" + }; + + return taskResult; + } catch (error) { + + } + return null; +} + +function isVip(url) { + try { + let isVip = false; + const host = new URL(url).hostname; + const vipWebsites = ["iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com"]; + for (let b = 0; b < vipWebsites.length; b++) { + if (host.includes(vipWebsites[b])) { + if (vipWebsites[b] === "iqiyi.com") { + // 爱奇艺需要特殊处理 + if (url.includes("iqiyi.com/a_") || url.includes("iqiyi.com/w_") || url.includes("iqiyi.com/v_")) { + isVip = true; + break; + } + } else { + isVip = true; + break; + } + } + } + return isVip; + } catch (e) { + } + return false; +} + + +function isBlackVodUrl(input, url) { + return url.includes("973973.xyz") || url.includes(".fit:"); +} + + +function fixJsonVodHeader(headers, input, url) { + if (headers === null) { + headers = {}; + } + + if (input.includes("www.mgtv.com")) { + headers["Referer"] = " "; + headers["User-Agent"] = " Mozilla/5.0"; + } else if (url.includes("titan.mgtv")) { + headers["Referer"] = " "; + headers["User-Agent"] = " Mozilla/5.0"; + } else if (input.includes("bilibili")) { + headers["Referer"] = " https://www.bilibili.com/"; + headers["User-Agent"] = " " + Misc.UaWinChrome; + } + + return headers; +} + + + + + +const snifferMatch = /http((?!http).){26,}?\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)\?.*|http((?!http).){26,}\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)|http((?!http).){26,}\/m3u8\?pt=m3u8.*|http((?!http).)*?default\.ixigua\.com\/.*|http((?!http).)*?cdn-tos[^\?]*|http((?!http).)*?\/obj\/tos[^\?]*|http.*?\/player\/m3u8play\.php\?url=.*|http.*?\/player\/.*?[pP]lay\.php\?url=.*|http.*?\/playlist\/m3u8\/\?vid=.*|http.*?\.php\?type=m3u8&.*|http.*?\/download.aspx\?.*|http.*?\/api\/up_api.php\?.*|https.*?\.66yk\.cn.*|http((?!http).)*?netease\.com\/file\/.*/; + +function isVideoFormat(url) { + if (snifferMatch.test(url)) { + return !url.includes("cdn-tos") || !url.includes(".js"); + } + return false; + +} + +function isVideo(url) { + if (!url.includes(".mp4") || !url.includes(".m3u8")) { + return true; + } + return false; +} + + + + +function UA(url) { + if (url.includes(".vod")) { + return "okhttp/4.1.0"; + } +} + +function getCateUrl(URL) { + if (URL.includes("api.php/app") || URL.includes("xgapp")) { + return URL + "nav?token="; + } else if (URL.includes(".vod")) { + return URL + "/types"; + } else { + return ""; + } +} + +function getPlayUrlPrefix(URL) { + if (URL.includes("api.php/app") || URL.includes("xgapp")) { + return URL + "video_detail?id="; + } else if (URL.includes(".vod")) { + return URL + "/detail?vod_id="; + } else { + return ""; + } +} + +function getRecommendUrl(URL) { + if (URL.includes("api.php/app") || URL.includes("xgapp")) { + return URL + "index_video?token="; + } else if (URL.includes(".vod")) { + return URL + "/vodPhbAll"; + } else { + return ""; + } +} + +function getFilterTypes(URL, typeExtend) { + let str = ""; + + if (typeExtend !== null) { + for (let key in typeExtend) { + if (key === "class" || key === "area" || key === "lang" || key === "year") { + try { + + str += "筛选" + key + "+全部=+" + typeExtend[key].replace(/,/g, "+") + "\n"; + } catch (e) { } + } + } + } + + if (URL.includes(".vod")) { + str += "\n" + "排序+全部=+最新=time+最热=hits+评分=score"; + } else if (URL.includes("api.php/app") || URL.includes("xgapp")) { + // Do nothing, leave the string as it is. + } else { + str = "分类+全部=+电影=movie+连续剧=tvplay+综艺=tvshow+动漫=comic+4K=movie_4k+体育=tiyu\n筛选class+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+惊悚+伦理+情色+福利+三级+儿童+网络电影\n筛选area+全部=+大陆+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n筛选year+全部=+2023+2022+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000"; + } + + return str; +} + +function getCateFilterUrlSuffix(URL) { + if (URL.includes("api.php/app") || URL.includes("xgapp")) { + return "&class=筛选class&area=筛选area&lang=筛选lang&year=筛选year&limit=18&pg=#PN#"; + } else if (URL.includes(".vod")) { + return "&class=筛选class&area=筛选area&lang=筛选lang&year=筛选year&by=排序&limit=18&page=#PN#"; + } else { + return "&page=#PN#&area=筛选area&type=筛选class&start=筛选year"; + } +} + +function getCateFilterUrlPrefix(URL) { + if (URL.includes("api.php/app") || URL.includes("xgapp")) { + return URL + "video?tid="; + } else if (URL.includes(".vod")) { + return URL + "?type="; + } else { + return URL + "?ac=list&class="; + } +} + +function isBan(key) { + return key === "伦理" || key === "情色" || key === "福利"; +} + +function getSearchUrl(URL, KEY) { + if (URL.includes(".vod")) { + return URL + "?wd=" + KEY + "&page="; + } else if (URL.includes("api.php/app") || URL.includes("xgapp")) { + return URL + "search?text=" + KEY + "&pg="; + } else if (urlPattern1.test(URL)) { + return URL + "?ac=list&zm=" + KEY + "&page="; + } + return ""; +} + +function findJsonArray(obj, match, result) { + Object.keys(obj).forEach((k) => { + try { + const o = obj[k]; + if (k === match && Array.isArray(o)) { + result.push(o); + } + if (typeof o === "object" && o !== null) { + if (Array.isArray(o)) { + o.forEach((item) => { + if (typeof item === "object" && item !== null) { + findJsonArray(item, match, result); + } + }); + } else { + findJsonArray(o, match, result); + } + } + } catch (e) { + } + }); +} + +function jsonArr2Str(array) { + const strings = []; + for (let i = 0; i < array.length; i++) { + try { + strings.push(array[i]); + } catch (e) { + } + } + return strings.join(","); +} + +function getHeaders(URL) { + const headers = {}; + headers["User-Agent"] = UA(URL); + return headers; +} + +function isJsonString(str) { + try { + JSON.parse(str); + } catch (e) { + return false; + } + return true; +} + + + + +export function __jsEvalReturn() { + return { + init: init, + home: home, + homeVod: homeVod, + category: category, + detail: detail, + play: play, + search: search, + }; +} + diff --git a/js/libvio.js b/js/libvio.js new file mode 100644 index 00000000..12f86358 --- /dev/null +++ b/js/libvio.js @@ -0,0 +1,137 @@ +// 永久网址:https://libvio.app +muban.首图2.二级.title = 'h1&&Text;.data:eq(0)&&Text' +muban.首图2.二级.desc = '.data.hidden-xs&&Text;;;.data:eq(1)&&Text;.data:eq(4)&&Text' +muban.首图2.二级.content = '.detail-content&&Text' +var rule = { + title:'LIBVIO', + 模板:'首图2', + // host:'https://tv.libvio.cc', + host:'https://tv.libvio.cc', + //hostJs:'print(HOST);let html=request(HOST,{headers:{"User-Agent":PC_UA}});let src=jsp.pdfh(html,"li:eq(0)&&a:eq(0)&&href");print(src);HOST=src', + // url:'/type/fyclass-fypage.html', + url:'/show/fyclassfyfilter.html', + // url:'/show_fyclassfyfilter.html', + filterable:1,//是否启用分类筛选, + filter_url:'-{{fl.area}}-{{fl.by}}--{{fl.lang}}----fypage---{{fl.year}}', + filter: { + "1":[{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"中国香港","v":"中国香港"},{"n":"中国台湾","v":"中国台湾"},{"n":"美国","v":"美国"},{"n":"法国","v":"法国"},{"n":"英国","v":"英国"},{"n":"日本","v":"日本"},{"n":"韩国","v":"韩国"},{"n":"德国","v":"德国"},{"n":"泰国","v":"泰国"},{"n":"印度","v":"印度"},{"n":"意大利","v":"意大利"},{"n":"西班牙","v":"西班牙"},{"n":"加拿大","v":"加拿大"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"法语","v":"法语"},{"n":"德语","v":"德语"},{"n":"其它","v":"其它"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}], + "2":[{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"中国台湾","v":"中国台湾"},{"n":"中国香港","v":"中国香港"},{"n":"韩国","v":"韩国"},{"n":"日本","v":"日本"},{"n":"美国","v":"美国"},{"n":"泰国","v":"泰国"},{"n":"英国","v":"英国"},{"n":"新加坡","v":"新加坡"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}], + "4":[{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"中国","v":"中国"},{"n":"日本","v":"日本"},{"n":"欧美","v":"欧美"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"},{"n":"2009","v":"2009"},{"n":"2008","v":"2008"},{"n":"2007","v":"2007"},{"n":"2006","v":"2006"},{"n":"2005","v":"2005"},{"n":"2004","v":"2004"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}], + "27":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}], + "15":[{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"日本","v":"日本"},{"n":"韩国","v":"韩国"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}], + "16":[{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"美国","v":"美国"},{"n":"英国","v":"英国"},{"n":"德国","v":"德国"},{"n":"加拿大","v":"加拿大"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}] + }, + headers:{//网站的请求头,完整支持所有的,常带ua和cookies + 'User-Agent':'MOBILE_UA' + }, + class_parse:'.stui-header__menu li:gt(0):lt(7);a&&Text;a&&href;/(\\d+).html', + // class_parse:'.stui-header__menu li;a&&Text;a&&href;/.*_(\\d+).html', + tab_exclude: '百度', + pagecount:{"27":1}, + 二级: { + "title": ".stui-content__detail .title&&Text;.stui-content__detail p:eq(-2)&&Text", + "img": ".stui-content__thumb .lazyload&&data-original", + "desc": ".stui-content__detail p:eq(0)&&Text;.stui-content__detail p:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text", + "content": ".detail&&Text", + "tabs": `js: +pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd; +TABS=[]; +let tabsq=[]; +let tabsm3u8=[]; +let d = pdfa(html, 'div.stui-vodlist__head'); +d.forEach(function(it) { + let name = pdfh(it, 'h3&&Text'); + if (!/(猜你|喜欢|剧情|热播)/.test(name)){ + log("libvio tabs name>>>>>>>>>>>>>>>" + name); + if (name.includes("夸克")){ + tabsq.push("夸克網盤"); + }else if (name.includes("阿里")){ + tabsq.push("阿里雲盤"); + }else{ + tabsm3u8.push(name); + } + } +}); +if (tabsq.length==1){ + TABS=TABS.concat(tabsq); +}else{ + let tmpIndex=1; + tabsq.forEach(function(it){ + TABS.push(it+tmpIndex); + tmpIndex++; + }); +} +TABS=TABS.concat(tabsm3u8); +log('libvio TABS >>>>>>>>>>>>>>>>>>' + TABS); +`, + "lists":`js: +pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd; +LISTS = []; +let listq=[]; +let listm3u8=[]; +let d = pdfa(html, 'div.stui-vodlist__head'); +d.forEach(function(it){ + let name = pdfh(it, 'h3&&Text'); + if (!/(猜你|喜欢|剧情|热播)/.test(name)){ + log("libvio tabs name>>>>>>>>>>>>>>>" + name); + let durl = pdfa(it, 'ul li'); + let dd = []; + durl.forEach(function(it1){ + let dhref = pd(it1, 'a&&href', HOST); + let dname = pdfh(it1, 'a&&Text'); + dd.push(dname + "$" + dhref); + }); + if (/(夸克|阿里)/.test(name)){ + listq.push(dd); + }else{ + listm3u8.push(dd); + } + } +}); +LISTS=LISTS.concat(listq); +LISTS=LISTS.concat(listm3u8); +`, + }, + lazy:`js: +log("libvio lazy player input>>>>>>>>>>>>"+input); +var html = JSON.parse(request(input).match(/r player_.*?=(.*?)>>>>>>>>>>>"+JSON.stringify(html)); +var url = html.url; +var from = html.from; +var next = html.link_next; +var id = html.id; +var nid = html.nid; +if (/(www.aliyundrive.com|pan.quark.cn)/.test(url)){ + let confirm = ""; + if (TABS.length==1){ + confirm="&confirm=0"; + } + let type="ali"; + if (url.includes("www.aliyundrive.com")){ + type = "ali"; + }else if (url.includes("pan.quark.cn")){ + type = "quark"; + } + input = { + jx: 0, + url: 'http://127.0.0.1:9978/proxy?do=' + type +'&type=push' + confirm + '&url=' + encodeURIComponent(url), + parse: 0 + } +}else{ + var paurl = request("https://libvio.cc/static/player/" + from + ".js").match(/ src="(.*?)'/)[1]; + if (/https/.test(paurl)) { + var purl = paurl + url + "&next=" + next + "&id=" + id + "&nid=" + nid; + input = { + jx: 0, + url: request(purl).match(/var .* = '(.*?)'/)[1], + parse: 0 + } + } +} +`, + searchUrl:'/index.php/ajax/suggest?mid=1&wd=**&limit=50', + detailUrl:'/detail/fyid.html', //非必填,二级详情拼接链接 + // detailUrl:'/detail_fyid.html', //非必填,二级详情拼接链接 + // searchUrl:'/search/**----------fypage---.html', + 搜索:'json:list;name;pic;;id', +}