提交 6a5de75a 编写于 作者: H hjdhnx

版本升级,增加新特性

上级 e2736dc4
无法预览此类型文件
......@@ -15,7 +15,7 @@ from utils.system import getHost
from utils.config import playerConfig
from utils.log import logger
from utils.encode import base64Encode,base64Decode,fetch,post,request,getCryptoJS,getPreJs,buildUrl,getHome
from utils.encode import verifyCode,setDetail,join,urljoin2,parseText,requireCache
from utils.encode import verifyCode,setDetail,join,urljoin2,parseText,requireCache,forceOrder
from utils.encode import md5 as mmd5
from utils.safePython import safePython
from utils.parser import runPy,runJScode,JsObjectWrapper,PyJsObject,PyJsString
......@@ -1091,7 +1091,12 @@ class CMS:
vodList = [(pdfh(html, tab_ext) if tab_ext else tab_name) + '$' + play_url + i for i in
vodList] if is_json else \
[pdfh(i,list_text) + '$' + play_url + pd(i, list_url) for i in vodList] # 拼接成 名称$链接
# print(vodList)
vodList = forceOrder(vodList,option=lambda x:x.split('$')[0])
# print(vodList)
vlist = '#'.join(vodList) # 拼多个选集
# print(vlist)
vod_tab_list.append(vlist)
vod_play_url = vod_play_url.join(vod_tab_list)
......
3.9.25
\ No newline at end of file
3.9.25beta1
\ No newline at end of file
......@@ -53,7 +53,7 @@ function pre(){
}
let rule = {};
const VERSION = 'drpy1 3.9.25 20221126';
const VERSION = 'drpy1 3.9.25beta1 20221126';
/** 已知问题记录
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下,支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼,最新的文件发现这问题已经解决了]
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
......@@ -398,6 +398,47 @@ function getCryptoJS(){
return 'console.log("CryptoJS已装载");'
}
/**
* 强制正序算法
* @param lists 待正序列表
* @param key 正序键
* @param option 单个元素处理函数
* @returns {*}
*/
function forceOrder(lists,key,option){
let start = Math.floor(lists.length/2);
let end = Math.min(lists.length-1,start+1);
if(start >= end){
return lists;
}
let first = lists[start];
let second = lists[end];
if(key){
try {
first = first[key];
second = second[key];
}catch (e) {}
}
if(option && typeof(option)==='function'){
try {
first = option(first);
second = option(second);
}catch (e) {}
}
first+='';
second+='';
// console.log(first,second);
if(first.match(/(\d+)/)&&second.match(/(\d+)/)){
let num1 = Number(first.match(/(\d+)/)[1]);
let num2 = Number(second.match(/(\d+)/)[1]);
if (num1 > num2){
lists.reverse();
}
}
return lists
}
let VODS = [];// 一级或者搜索需要的数据列表
let VOD = {};// 二级的单个数据
let TABS = [];// 二级的自定义线路列表 如: TABS=['道长在线','道长在线2']
......@@ -1862,6 +1903,7 @@ function detailParse(detailObj){
new_vod_list.push(_pdfh(it, list_text).trim() + '$' +_pd(it, list_url,MY_URL));
});
if(vodList.length>0){
new_vod_list = forceOrder(new_vod_list,'',x=>x.split('$')[0]);
console.log(`drpy影响性能代码共计列表数循环次数:${vodList.length},耗时:${(new Date()).getTime()-tt1}毫秒`);
}
let vlist = new_vod_list.join('#');
......
此差异已折叠。
......@@ -31,7 +31,7 @@ function pre(){
}
let rule = {};
const VERSION = 'drpy2 3.9.25 20221126';
const VERSION = 'drpy2 3.9.25beta1 20221126';
/** 已知问题记录
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下,支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼,最新的文件发现这问题已经解决了]
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
......@@ -378,6 +378,46 @@ function getCryptoJS(){
return 'console.log("CryptoJS已装载");'
}
/**
* 强制正序算法
* @param lists 待正序列表
* @param key 正序键
* @param option 单个元素处理函数
* @returns {*}
*/
function forceOrder(lists,key,option){
let start = Math.floor(lists.length/2);
let end = Math.min(lists.length-1,start+1);
if(start >= end){
return lists;
}
let first = lists[start];
let second = lists[end];
if(key){
try {
first = first[key];
second = second[key];
}catch (e) {}
}
if(option && typeof(option)==='function'){
try {
first = option(first);
second = option(second);
}catch (e) {}
}
first+='';
second+='';
// console.log(first,second);
if(first.match(/(\d+)/)&&second.match(/(\d+)/)){
let num1 = Number(first.match(/(\d+)/)[1]);
let num2 = Number(second.match(/(\d+)/)[1]);
if (num1 > num2){
lists.reverse();
}
}
return lists
}
let VODS = [];// 一级或者搜索需要的数据列表
let VOD = {};// 二级的单个数据
let TABS = [];// 二级的自定义线路列表 如: TABS=['道长在线','道长在线2']
......@@ -1727,8 +1767,10 @@ function detailParse(detailObj){
new_vod_list.push(_pdfh(it, list_text).trim() + '$' +_pd(it, list_url,MY_URL));
});
if(vodList.length>0){
new_vod_list = forceOrder(new_vod_list,'',x=>x.split('$')[0]);
console.log(`drpy影响性能代码共计列表数循环次数:${vodList.length},耗时:${(new Date()).getTime()-tt1}毫秒`);
}
// print(new_vod_list);
let vlist = new_vod_list.join('#');
vod_tab_list.push(vlist);
}
......
此差异已折叠。
......@@ -52,6 +52,7 @@
###### 2022/11/26
- [X] drpy系列资源接口修复,推荐为double的情况也支持第二个定位写*自动继承一级的第一个定位(参考乐猪TV)
- [X] V3.9.25新特性:搜索支持post(参考乐猪TV) 格式为 搜索链接;post (搜索参数用#传递)
- [X] V3.9.25beta1 增加部分源二级选集列表强制正序
###### 2022/11/25
- [X] 优化腾云驾雾源,方便追剧
- [X] 增加新解析并修复酷云自建解析
......
......@@ -5,6 +5,8 @@
# Date : 2022/8/29
import base64
import math
import re
from urllib.parse import urljoin,quote,unquote
from js2py.base import PyJsString
import requests,warnings
......@@ -366,4 +368,40 @@ def buildUrl(url,obj=None):
# url = (url + prs).replace('"','').replace("'",'')
url = url + prs
# print(url)
return url
\ No newline at end of file
return url
def forceOrder(lists:list,key:str=None,option=None):
"""
强制正序
:param lists:
:param key:
:return:
"""
start = math.floor(len(lists)/2)
end = min(len(lists)-1,start+1)
if start >= end:
return lists
first = lists[start]
second = lists[end]
if key:
try:
first = first[key]
second = second[key]
except:
pass
if option and hasattr(option, '__call__'):
try:
first = option(first)
second = option(second)
# print(f'first:{first},second:{second}')
except Exception as e:
print(f'强制排序执行option发生了错误:{e}')
first = str(first)
second = str(second)
if re.search(r'(\d+)',first) and re.search(r'(\d+)',second):
num1 = int(re.search(r'(\d+)',first).groups()[0])
num2 = int(re.search(r'(\d+)',second).groups()[0])
if num1 > num2:
lists.reverse()
return lists
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册