From de0d50500581173c073da2ffb7b1c55eace05459 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Tue, 11 Jun 2024 17:08:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJyData.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJyData.js | 1247 +++++++++++++++++++++++++------------------------- 1 file changed, 635 insertions(+), 612 deletions(-) diff --git a/SrcJyData.js b/SrcJyData.js index 2b63ba8d..264c4701 100644 --- a/SrcJyData.js +++ b/SrcJyData.js @@ -4,14 +4,14 @@ function getYiData(jkdata) { let fllists; let vodlists; - let error ={}; - let api_name = jkdata.name||""; - let api_type = jkdata.type||""; - let api_url = jkdata.url||""; - let api_ua = jkdata.ua||"MOBILE_UA"; - api_ua = api_ua=="MOBILE_UA"?MOBILE_UA:api_ua=="PC_UA"?PC_UA:api_ua; + let error = {}; + let api_name = jkdata.name || ""; + let api_type = jkdata.type || ""; + let api_url = jkdata.url || ""; + let api_ua = jkdata.ua || "MOBILE_UA"; + api_ua = api_ua == "MOBILE_UA" ? MOBILE_UA : api_ua == "PC_UA" ? PC_UA : api_ua; let headers = { 'User-Agent': api_ua }; - let vodurlhead,classurl,listurl,listnode,extdata; + let vodurlhead, classurl, listurl, listnode, extdata; //分类变量 let fold = getMyVar('SrcJu_dianbo$fold', "0");//是否展开小分类筛选 let cate_id = getMyVar('SrcJu_dianbo$分类', ''); @@ -19,189 +19,189 @@ function getYiData(jkdata) { let fl = storage0.getMyVar('SrcJu_dianbo$flCache') || {}; //基础链接拼接 - if (api_type=="v1") { + if (api_type == "v1") { let date = new Date(); - let mm = date.getMonth()+1; + let mm = date.getMonth() + 1; let dd = date.getDate(); - let key = (mm<10?"0"+mm:mm)+""+(dd<10?"0"+dd:dd); - vodurlhead = api_url + '/detail?&key='+key+'&vod_id='; + let key = (mm < 10 ? "0" + mm : mm) + "" + (dd < 10 ? "0" + dd : dd); + vodurlhead = api_url + '/detail?&key=' + key + '&vod_id='; classurl = api_url + "/types"; - listurl = api_url + '?key='+key+'&page='; + listurl = api_url + '?key=' + key + '&page='; listnode = "json.data.list"; - } else if (api_type=="app") { + } else if (api_type == "app") { vodurlhead = api_url + 'video_detail?id='; classurl = api_url + "nav"; listurl = api_url + 'video?tid=@type_id&pg='; listnode = "json.list"; - } else if (api_type=="v2") { + } else if (api_type == "v2") { vodurlhead = api_url + 'video_detail?id='; classurl = api_url + "nav"; listurl = api_url + 'video?tid=@type_id&pg='; listnode = "json.data"; - } else if (api_type=="iptv") { + } else if (api_type == "iptv") { vodurlhead = api_url + '?ac=detail&ids='; classurl = api_url + "?ac=flitter"; listurl = api_url + '?ac=list&page='; listnode = "json.data"; - } else if (api_type=="cms") { + } else if (api_type == "cms") { vodurlhead = api_url + '?ac=videolist&ids='; classurl = api_url + "?ac=list"; listurl = api_url + '?ac=videolist&pg='; listnode = "json.list"; } else if (/XBPQ|XPath|XYQ/.test(api_type)) { extdata = extDataCache(jkdata) - if($.type(extdata)=='object'){ - if(api_type=="XBPQ"){ + if ($.type(extdata) == 'object') { + if (api_type == "XBPQ") { let host = extdata["主页url"] || ''; classurl = extdata["分类"]; - extdata["分类url"] = extdata["分类url"]?extdata["分类url"].split(';;')[0].split('[')[0]:""; - listurl = extdata["分类url"]?/^http/.test(extdata["分类url"])?extdata["分类url"]:host + extdata["分类url"]:""; - }else if (api_type=="XPath") { + extdata["分类url"] = extdata["分类url"] ? extdata["分类url"].split(';;')[0].split('[')[0] : ""; + listurl = extdata["分类url"] ? /^http/.test(extdata["分类url"]) ? extdata["分类url"] : host + extdata["分类url"] : ""; + } else if (api_type == "XPath") { let host = extdata["homeUrl"] || ''; classurl = host; - extdata["cateUrl"] = extdata["cateUrl"]?extdata["cateUrl"].split(';;')[0].split('[')[0]:""; - listurl = extdata["cateUrl"]?/^http/.test(extdata["cateUrl"])?extdata["cateUrl"]:host + extdata["cateUrl"]:""; - }else if (api_type=="XYQ") { - if(extdata["请求头参数"]){ - if(extdata["请求头参数"].includes('#')){ - extdata["请求头参数"].split('#').forEach(v=>{ + extdata["cateUrl"] = extdata["cateUrl"] ? extdata["cateUrl"].split(';;')[0].split('[')[0] : ""; + listurl = extdata["cateUrl"] ? /^http/.test(extdata["cateUrl"]) ? extdata["cateUrl"] : host + extdata["cateUrl"] : ""; + } else if (api_type == "XYQ") { + if (extdata["请求头参数"]) { + if (extdata["请求头参数"].includes('#') || extdata["请求头参数"].includes('$')) { + extdata["请求头参数"].split('#').forEach(v => { headers[v.split('$')[0]] = v.split('$')[1]; }) - }else{ + } else { headers["User-Agent"] = extdata["请求头参数"] || headers["User-Agent"]; } } - headers["User-Agent"] = (headers["User-Agent"]=="电脑"||headers["User-Agent"]=="PC_UA")?PC_UA:MOBILE_UA; + headers["User-Agent"] = (headers["User-Agent"] == "电脑" || headers["User-Agent"] == "PC_UA") ? PC_UA : MOBILE_UA; let host = extdata["首页推荐链接"] || ''; classurl = host; - extdata["分类链接"] = extdata["分类链接"]?extdata["分类链接"].split(';;')[0].split('[')[0]:""; - listurl = extdata["分类链接"]?/^http/.test(extdata["分类链接"])?extdata["分类链接"]:host + extdata["分类链接"]:""; + extdata["分类链接"] = extdata["分类链接"] ? extdata["分类链接"].split(';;')[0].split('[')[0] : ""; + listurl = extdata["分类链接"] ? /^http/.test(extdata["分类链接"]) ? extdata["分类链接"] : host + extdata["分类链接"] : ""; } vodurlhead = getHome(listurl); } } else { - log(api_type+'>api类型错误'); + log(api_type + '>api类型错误'); } //一级第1页生成分类数据 - if(MY_PAGE==1){ - if(classurl){ + if (MY_PAGE == 1) { + if (classurl) { MY_URL = classurl; let 推荐 = []; let 分类 = []; let 筛选; - - let cate_exclude = ['主页','求片/留言']; + + let cate_exclude = ['主页', '求片/留言']; const Color = "#3399cc"; let classCache = storage0.getMyVar('SrcJu_dianbo$classCache'); - if(classCache){ + if (classCache) { 推荐 = classCache.推荐; 分类 = classCache.分类; 筛选 = classCache.筛选; - }else{ - try{ - if(api_type=="XYQ"){ - if(extdata['是否开启获取首页数据'] && extdata['首页列表数组规则']){ - let gethtml = getHtml(classurl,headers); + } else { + try { + if (api_type == "XYQ") { + if (extdata['是否开启获取首页数据'] && extdata['首页列表数组规则']) { + let gethtml = getHtml(classurl, headers); let 首页列表数组 = pdfa(gethtml, extdata['首页列表数组规则']); - 首页列表数组.forEach(it=>{ - pdfa(it, extdata['首页片单列表数组规则']).forEach(v=>{ - if(extdata['首页片单是否Jsoup写法']=="1"){ - let vodid = pd(v, extdata['首页片单链接']||extdata['分类片单链接'], vodurlhead); - let vodname = pdfh(v, extdata['首页片单标题']||extdata['分类片单标题']); - let vodpic = pdfh(v, extdata['首页片单图片']||extdata['分类片单图片']); - let voddesc = pdfh(v, extdata['首页片单副标题']||extdata['分类片单副标题']); - if(vodid&&vodname){ - vodpic = /^\//.test(vodpic)?vodurlhead+vodpic:vodpic; - vodpic = vodpic.includes('(')?vodpic.match(/\(\'(.*?)\'\)/)[1]:vodpic; - 推荐.push({"vod_url":vodid,"vod_name":vodname,"vod_desc":voddesc,"vod_pic":vodpic}); + 首页列表数组.forEach(it => { + pdfa(it, extdata['首页片单列表数组规则']).forEach(v => { + if (extdata['首页片单是否Jsoup写法'] == "1") { + let vodid = pd(v, extdata['首页片单链接'] || extdata['分类片单链接'], vodurlhead); + let vodname = pdfh(v, extdata['首页片单标题'] || extdata['分类片单标题']); + let vodpic = pdfh(v, extdata['首页片单图片'] || extdata['分类片单图片']); + let voddesc = pdfh(v, extdata['首页片单副标题'] || extdata['分类片单副标题']); + if (vodid && vodname) { + vodpic = /^\//.test(vodpic) ? vodurlhead + vodpic : vodpic; + vodpic = vodpic.includes('(') ? vodpic.match(/\(\'(.*?)\'\)/)[1] : vodpic; + 推荐.push({ "vod_url": vodid, "vod_name": vodname, "vod_desc": voddesc, "vod_pic": vodpic }); } } }) }) } - let typenames = extdata['分类名称']?extdata['分类名称'].split('&'):[]; - let typeids = extdata['分类名称替换词']?extdata['分类名称替换词'].split('&'):[]; - for(let i in typeids){ - if(cate_exclude.indexOf(typenames[i])==-1){ - 分类.push(typenames[i]+'$'+typeids[i]); + let typenames = extdata['分类名称'] ? extdata['分类名称'].split('&') : []; + let typeids = extdata['分类名称替换词'] ? extdata['分类名称替换词'].split('&') : []; + for (let i in typeids) { + if (cate_exclude.indexOf(typenames[i]) == -1) { + 分类.push(typenames[i] + '$' + typeids[i]); } } - if($.type(extdata['筛选数据'])=="string" && extdata['筛选数据']=="ext"){ - let 筛选循环 = ["子分类","类型","地区","年份","语言","排序"]; - let 筛选循环id = ["cateId","class","area","year","lang","by"]; - 筛选循环.forEach((it,id)=>{ - if(extdata['筛选'+it+'名称'] && extdata['筛选'+it+'替换词']){ - extdata['筛选'+it+'替换词'] = extdata['筛选'+it+'替换词']=="*"?extdata['筛选'+it+'名称']:extdata['筛选'+it+'替换词']; - let catenames = extdata['筛选'+it+'名称'].split('||'); - let cateids = extdata['筛选'+it+'替换词'].split('||'); - if(it=="排序"){ + if ($.type(extdata['筛选数据']) == "string" && extdata['筛选数据'] == "ext") { + let 筛选循环 = ["子分类", "类型", "地区", "年份", "语言", "排序"]; + let 筛选循环id = ["cateId", "class", "area", "year", "lang", "by"]; + 筛选循环.forEach((it, id) => { + if (extdata['筛选' + it + '名称'] && extdata['筛选' + it + '替换词']) { + extdata['筛选' + it + '替换词'] = extdata['筛选' + it + '替换词'] == "*" ? extdata['筛选' + it + '名称'] : extdata['筛选' + it + '替换词']; + let catenames = extdata['筛选' + it + '名称'].split('||'); + let cateids = extdata['筛选' + it + '替换词'].split('||'); + if (it == "排序") { for (let i = 0; i < typeids.length; i++) { catenames = catenames.concat(catenames); cateids = cateids.concat(cateids); } } - cateids.forEach((x,i)=>{ + cateids.forEach((x, i) => { let value = []; let names = catenames[i].split('&'); let ids = cateids[i].split('&'); - for(let j in names){ - value.push({n:names[j],v:ids[j]}); + for (let j in names) { + value.push({ n: names[j], v: ids[j] }); } - if(value.length>0){ - if(it!="排序"){ - value.unshift({n:"全部",v:""}); + if (value.length > 0) { + if (it != "排序") { + value.unshift({ n: "全部", v: "" }); } 筛选 = 筛选 || {}; 筛选[typeids[i]] = 筛选[typeids[i]] || []; - 筛选[typeids[i]].push({"key":筛选循环id[id],"name":it,"value":value}); + 筛选[typeids[i]].push({ "key": 筛选循环id[id], "name": it, "value": value }); } }) } }) } - }else if(api_type=="XPath"){ + } else if (api_type == "XPath") { let gethtml = getHtml(classurl, headers); - let typenames = xpathArray(gethtml,extdata['cateNode']+extdata['cateName']); - let typeids = xpathArray(gethtml,extdata['cateNode']+extdata['cateId']); - if(extdata['cateIdR']){ - typeids = typeids.map(x=>{ + let typenames = xpathArray(gethtml, extdata['cateNode'] + extdata['cateName']); + let typeids = xpathArray(gethtml, extdata['cateNode'] + extdata['cateId']); + if (extdata['cateIdR']) { + typeids = typeids.map(x => { return x.match(extdata['cateIdR'])[1]; }) } - for(let i in typeids){ - if(cate_exclude.indexOf(typenames[i])==-1){ - 分类.push(typenames[i]+'$'+typeids[i]); + for (let i in typeids) { + if (cate_exclude.indexOf(typenames[i]) == -1) { + 分类.push(typenames[i] + '$' + typeids[i]); } } - }else if(api_type=="XBPQ"){ - if(extdata["分类"].indexOf('$')>-1){ + } else if (api_type == "XBPQ") { + if (extdata["分类"].indexOf('$') > -1) { 分类 = extdata["分类"].split('#'); - }else if(extdata["分类"].indexOf('&')>-1&&extdata["分类值"]){ + } else if (extdata["分类"].indexOf('&') > -1 && extdata["分类值"]) { let typenames = extdata["分类"].split('&'); let typeids = extdata["分类值"].split('&'); - for(let i in typeids){ - if(cate_exclude.indexOf(typenames[i])==-1){ - 分类.push(typenames[i]+'$'+typeids[i]); + for (let i in typeids) { + if (cate_exclude.indexOf(typenames[i]) == -1) { + 分类.push(typenames[i] + '$' + typeids[i]); } } } 筛选 = extdata["筛选"]; - }else{ + } else { let gethtml = getHtml(classurl, headers); - if (api_type=="v1") { + if (api_type == "v1") { let typehtml = JSON.parse(gethtml); - let typelist = typehtml.data.list||typehtml.data.typelist; - typelist.map((it)=>{ - 分类.push(it.type_name+'$'+it.type_id); + let typelist = typehtml.data.list || typehtml.data.typelist; + typelist.map((it) => { + 分类.push(it.type_name + '$' + it.type_id); }) } else if (/app|v2/.test(api_type)) { let typehtml = JSON.parse(gethtml); - let typelist = typehtml.list||typehtml.data; - typelist.forEach(it=>{ - 分类.push(it.type_name+'$'+it.type_id); + let typelist = typehtml.list || typehtml.data; + typelist.forEach(it => { + 分类.push(it.type_name + '$' + it.type_id); }) - } else if (api_type=="iptv") { + } else if (api_type == "iptv") { let type_dict = { comic: '动漫', movie: '电影', @@ -213,70 +213,70 @@ function getYiData(jkdata) { tiyu: '体育' }; let typelist = JSON.parse(gethtml); - typelist.forEach((it)=>{ - if(type_dict[it]){ - 分类.push(type_dict[it]+'$'+it); + typelist.forEach((it) => { + if (type_dict[it]) { + 分类.push(type_dict[it] + '$' + it); } }) - } else if (api_type=="cms") { - if(/<\?xml/.test(gethtml)){ - let typelist = pdfa(gethtml,'class&&ty'); - if(jkdata.categories){ - for(var i=0;i{ - 分类.push(String(xpath(it,`//ty/text()`)).trim()+'$'+String(xpath(it,`//ty/@id`)).trim()); + typelist.forEach((it) => { + 分类.push(String(xpath(it, `//ty/text()`)).trim() + '$' + String(xpath(it, `//ty/@id`)).trim()); }) - }else{ + } else { let typehtml = JSON.parse(gethtml); let typelist = typehtml.class; - if(jkdata.categories){ - for(var i=0;i{ - if(it.type_pid==0){ - 分类.push(it.type_name+'$'+it.type_id); + typelist.forEach((it) => { + if (it.type_pid == 0) { + 分类.push(it.type_name + '$' + it.type_id); let value = []; - typelist.forEach((itit)=>{ - if(itit.type_pid==it.type_id){ - value.push({n:itit.type_name,v:itit.type_id}); + typelist.forEach((itit) => { + if (itit.type_pid == it.type_id) { + value.push({ n: itit.type_name, v: itit.type_id }); } }) - if(value.length>0){ + if (value.length > 0) { 筛选 = 筛选 || {}; - 筛选[it.type_id] = [{"key":"cateId","name":it.type_name,"value":value}]; + 筛选[it.type_id] = [{ "key": "cateId", "name": it.type_name, "value": value }]; } } }) } } } - }catch(e){ + } catch (e) { error.fl = 1; - log(api_name+'>获取分类数据异常>'+e.message + " 错误行#" + e.lineNumber); + log(api_name + '>获取分类数据异常>' + e.message + " 错误行#" + e.lineNumber); } - if(分类.length>0){ - storage0.putMyVar('SrcJu_dianbo$classCache', {分类:分类,筛选:筛选,推荐:推荐}); + if (分类.length > 0) { + storage0.putMyVar('SrcJu_dianbo$classCache', { 分类: 分类, 筛选: 筛选, 推荐: 推荐 }); } } - if(分类.length>0){ + if (分类.length > 0) { fllists = []; - try{ - cate_id = getMyVar('SrcJu_dianbo$分类', 推荐.length>0?'tj':分类[0].split('$')[1]); + try { + cate_id = getMyVar('SrcJu_dianbo$分类', 推荐.length > 0 ? 'tj' : 分类[0].split('$')[1]); - if(筛选 && api_type!='cms' && cate_id !='tj'){ + if (筛选 && api_type != 'cms' && cate_id != 'tj') { fllists.push({ title: fold === '1' ? '““””' : '““””', url: $('#noLoading#').lazyRule((fold) => { @@ -290,12 +290,12 @@ function getYiData(jkdata) { } putMyVar('SrcJu_dianbo$分类', cate_id); - if(推荐.length>0){ - if(cate_id == 'tj'){ + if (推荐.length > 0) { + if (cate_id == 'tj') { vodlists = 推荐;//当前分类为推荐,取推荐列表 } fllists.push({ - title: cate_id=='tj'?'““””' + '推荐' + '':'推荐', + title: cate_id == 'tj' ? '““””' + '推荐' + '' : '推荐', url: $('#noLoading#').lazyRule(() => { putMyVar('SrcJu_dianbo$分类', 'tj'); refreshPage(true); @@ -305,11 +305,11 @@ function getYiData(jkdata) { }); } - 分类.forEach((it,i)=>{ + 分类.forEach((it, i) => { let itname = it.split('$')[0]; let itid = it.split('$')[1]; fllists.push({ - title: cate_id==itid?'““””' + itname + '':itname, + title: cate_id == itid ? '““””' + itname + '' : itname, url: $('#noLoading#').lazyRule((itid) => { putMyVar('SrcJu_dianbo$分类', itid); clearMyVar('SrcJu_dianbo$flCache'); @@ -323,17 +323,17 @@ function getYiData(jkdata) { col_type: "blank_block" }); - if(筛选 && (fold=='1' || api_type=='cms')){ + if (筛选 && (fold == '1' || api_type == 'cms')) { Object.entries(筛选).forEach(([key, value]) => { //console.log(`Key: ${key}, Value: ${value}`); - if(key==cate_id){ - value.forEach(it=>{ - if(it.value.length>0){ + if (key == cate_id) { + value.forEach(it => { + if (it.value.length > 0) { fl[it.key] = fl[it.key] || it.value[0].v; - it.value.forEach((itit)=>{ + it.value.forEach((itit) => { fllists.push({ - title: fl[it.key]==itit.v?'““””' + itit.n + '':itit.n, - url: $('#noLoading#').lazyRule((flkey,itid) => { + title: fl[it.key] == itit.v ? '““””' + itit.n + '' : itit.n, + url: $('#noLoading#').lazyRule((flkey, itid) => { let fl = storage0.getMyVar('SrcJu_dianbo$flCache') || {}; fl[flkey] = itid; storage0.putMyVar('SrcJu_dianbo$flCache', fl); @@ -351,192 +351,192 @@ function getYiData(jkdata) { } }); } - storage0.putMyVar('SrcJu_dianbo$flCache', fl); - }catch(e){ + storage0.putMyVar('SrcJu_dianbo$flCache', fl); + } catch (e) { error.fl = 1; - log(api_name+'>生成分类数据异常>'+e.message + " 错误行#" + e.lineNumber); + log(api_name + '>生成分类数据异常>' + e.message + " 错误行#" + e.lineNumber); } } } } - if(listurl && !vodlists && !error.fl){ - try{ + if (listurl && !vodlists && !error.fl) { + try { fl.cateId = fl.cateId || cate_id; //拼接生成分类页url链接 - if(api_type=="XYQ"){ + if (api_type == "XYQ") { fl.catePg = MY_PAGE; let execStrs = getExecStrs(listurl); - execStrs.forEach(k=>{ - if(!fl[k] ){ - listurl = listurl.replace('/'+k+'/{'+k+'}',''); + execStrs.forEach(k => { + if (!fl[k]) { + listurl = listurl.replace('/' + k + '/{' + k + '}', ''); } }) - listurl = listurl.replace('{catePg}',MY_PAGE).replace(/{/g, '${fl.').replace(/}/g, ' || ""}'); + listurl = listurl.replace('{catePg}', MY_PAGE).replace(/{/g, '${fl.').replace(/}/g, ' || ""}'); eval(`listurl = \`${listurl}\`;`); MY_URL = listurl; - }else if(api_type=="XPath"){ + } else if (api_type == "XPath") { fl.catePg = MY_PAGE; let execStrs = getExecStrs(listurl); - execStrs.forEach(k=>{ - if(!fl[k] ){ - listurl = listurl.replace('/'+k+'/{'+k+'}',''); + execStrs.forEach(k => { + if (!fl[k]) { + listurl = listurl.replace('/' + k + '/{' + k + '}', ''); } }) - listurl = listurl.replace('{catePg}',MY_PAGE).replace(/{/g, '${fl.').replace(/}/g, ' || ""}'); + listurl = listurl.replace('{catePg}', MY_PAGE).replace(/{/g, '${fl.').replace(/}/g, ' || ""}'); eval(`listurl = \`${listurl}\`;`); MY_URL = listurl; - }else if(api_type=="XBPQ"){ + } else if (api_type == "XBPQ") { fl.catePg = MY_PAGE; let execStrs = getExecStrs(listurl); - execStrs.forEach(k=>{ - if(!fl[k] ){ - listurl = listurl.replace('/'+k+'/{'+k+'}',''); + execStrs.forEach(k => { + if (!fl[k]) { + listurl = listurl.replace('/' + k + '/{' + k + '}', ''); } }) - listurl = listurl.replace('{catePg}',extdata["起始页"]?MY_PAGE>extdata["起始页"]?MY_PAGE:extdata["起始页"]:MY_PAGE).replace(/{/g, '${fl.').replace(/}/g, ' || ""}'); + listurl = listurl.replace('{catePg}', extdata["起始页"] ? MY_PAGE > extdata["起始页"] ? MY_PAGE : extdata["起始页"] : MY_PAGE).replace(/{/g, '${fl.').replace(/}/g, ' || ""}'); eval(`listurl = \`${listurl}\`;`); MY_URL = listurl; - }else{ + } else { MY_URL = listurl + MY_PAGE; type_id = fl.cateId || ""; - if(api_type=="v2"||api_type=="app"){ - MY_URL = MY_URL.replace('@type_id',type_id); - }else if (api_type=="v1") { + if (api_type == "v2" || api_type == "app") { + MY_URL = MY_URL.replace('@type_id', type_id); + } else if (api_type == "v1") { MY_URL = MY_URL + '&type=' + type_id; - } else if (api_type=="iptv") { + } else if (api_type == "iptv") { MY_URL = MY_URL + '&class=' + type_id; } else { MY_URL = MY_URL + '&t=' + type_id; } } vodlists = []; - let vod_name,vod_pic,vod_url,vod_desc; - if(api_type=="XYQ"){ + let vod_name, vod_pic, vod_url, vod_desc; + if (api_type == "XYQ") { log(MY_URL); log(headers); let gethtml = getHtml(MY_URL, headers); - if(extdata['分类片单是否Jsoup写法']=="1" && extdata['分类列表数组规则']){ + if (extdata['分类片单是否Jsoup写法'] == "1" && extdata['分类列表数组规则']) { log("ok"); log(pdfa(gethtml, extdata['分类列表数组规则']).length); - pdfa(gethtml, extdata['分类列表数组规则']).forEach(it=>{ + pdfa(gethtml, extdata['分类列表数组规则']).forEach(it => { log(it); let vodname = pdfh(it, extdata['分类片单标题']); let vodid = pd(it, extdata['分类片单链接'], vodurlhead); let vodimg = (extdata["分类片单链接加前缀"] || "") + pdfh(it, extdata['分类片单图片']); let voddesc = pdfh(it, extdata['分类片单副标题']); - if(vodname && vodid){ - vodimg = /^\//.test(vodimg)?vodurlhead+vodimg:vodimg; - vodimg = vodimg.includes('(')?vodimg.match(/\(\'(.*?)\'\)/)[1]:vodimg; - let arr = {"vod_url":vodid,"vod_name":vodname,"vod_desc":voddesc,"vod_pic":vodimg}; + if (vodname && vodid) { + vodimg = /^\//.test(vodimg) ? vodurlhead + vodimg : vodimg; + vodimg = vodimg.includes('(') ? vodimg.match(/\(\'(.*?)\'\)/)[1] : vodimg; + let arr = { "vod_url": vodid, "vod_name": vodname, "vod_desc": voddesc, "vod_pic": vodimg }; vodlists.push(arr); } }) } - }else if(api_type=="XPath"){ + } else if (api_type == "XPath") { let gethtml = getHtml(MY_URL, headers); - let vodnames = xpathArray(gethtml, extdata["homeVodNode"]+extdata["homeVodName"]); - let vodids = xpathArray(gethtml, extdata["homeVodNode"]+extdata["homeVodId"]); - let vodimgs = xpathArray(gethtml, extdata["homeVodNode"]+extdata["homeVodImg"]); - let vodmarks = xpathArray(gethtml, extdata["homeVodNode"]+extdata["homeVodMark"]); - for(let i in vodids){ - if(vodids[i]&&vodnames[i]){ - let arr = {"vod_url":vodurlhead+vodids[i],"vod_name":vodnames[i],"vod_desc":vodmarks[i],"vod_pic":vodimgs[i]}; + let vodnames = xpathArray(gethtml, extdata["homeVodNode"] + extdata["homeVodName"]); + let vodids = xpathArray(gethtml, extdata["homeVodNode"] + extdata["homeVodId"]); + let vodimgs = xpathArray(gethtml, extdata["homeVodNode"] + extdata["homeVodImg"]); + let vodmarks = xpathArray(gethtml, extdata["homeVodNode"] + extdata["homeVodMark"]); + for (let i in vodids) { + if (vodids[i] && vodnames[i]) { + let arr = { "vod_url": vodurlhead + vodids[i], "vod_name": vodnames[i], "vod_desc": vodmarks[i], "vod_pic": vodimgs[i] }; vodlists.push(arr); } } - }else if(api_type=="XBPQ"){ + } else if (api_type == "XBPQ") { let gethtml = getHtml(MY_URL, headers); - extdata["二次截取"] = extdata["二次截取"] || (gethtml.indexOf(`