提交 6122a6a1 编写于 作者: H hjdhnx

进行了兼容性测试

上级 46c304bd
无法预览此类型文件
......@@ -11,7 +11,9 @@ class_url:'1&2&3&4&16&13&15&14',
play_parse:true,
lazy:'',
limit:6,
// 推荐:'ul.myui-vodlist;ul li;*;*;*;*',
推荐:'ul.myui-vodlist;li;*;*;*;*',
// 推荐:'ul.myui-vodlist;ul&&li;*;*;*;*', // 此写法本地js无效
double:true, // 推荐内容是否双层定位
一级:'.myui-vodlist__box;a&&title;.lazyload&&data-original;.tag&&Text;a&&href',
二级:{"title":"h1&&Text;.stui-content__detail&&p&&Text","img":".lazyload&&data-original","desc":".data:eq(0)&&Text;.data:eq(1)&&Text;.data:eq(2)&&Text;.data:eq(3)&&Text","content":".desc&&Text","tabs":".stui-pannel__head.bottom-line h3","lists":".stui-content__playlist:eq(#id) li"},
......
3.9.11beta1
\ No newline at end of file
3.9.11beta2
\ No newline at end of file
......@@ -628,18 +628,24 @@ const parseTags = {
},
pdfa(html, parse) {
if (!parse || !parse.trim()) {
print('!parse');
return [];
}
let eleFind = typeof html === 'object';
// print('parse前:'+parse);
if (parse.indexOf('&&') > -1) {
let sp = parse.split('&&');
for (let i in sp) {
if (!SELECT_REGEX_A.test(sp[i]) && i < sp.length - 1) {
sp[i] = sp[i] + ':eq(0)';
if(sp[i]!=='body'){
// sp[i] = sp[i] + ':eq(0)';
sp[i] = sp[i] + ':first';
}
}
}
parse = sp.join(' ');
}
// print('parse后:'+parse);
const $ = eleFind ? html.rr : cheerio.load(html);
let ret = eleFind ? ($(html.ele).is(parse) ? html.ele : $(html.ele).find(parse)) : $(parse);
let result = [];
......@@ -648,6 +654,7 @@ const parseTags = {
if (ret) {
ret.each(function (idx, ele) {
result.push({ rr: $, ele: ele });
// result.push({ rr: $, ele: $(ele).prop("outerHTML")}); // 性能贼差
});
}
return result;
......@@ -1081,6 +1088,7 @@ function homeVodParse(homeVodObj){
MY_URL = homeVodObj.homeUrl;
// setItem('MY_URL',MY_URL);
console.log(MY_URL);
let t1 = (new Date()).getTime();
let p = homeVodObj.推荐;
print('p:'+p);
if(p==='*' && rule.一级){
......@@ -1224,6 +1232,8 @@ function homeVodParse(homeVodObj){
}
}
let t2 = (new Date()).getTime();
console.log('加载首页推荐耗时:'+(t2-t1)+'毫秒');
// console.log(JSON.stringify(d));
return JSON.stringify({
list:d
......
此差异已折叠。
......@@ -84,4 +84,19 @@ find . -iname drpy.txt
# 道长专用完整命令
docker run -it -p 5705:5705 -p 9001:9001 -v /home/pywork/kod/data/files/dr_py:/root/sd/pywork/dr_py --restart=always --name drpy -d hjdhnx/drpy
docker run -it -p 5705:5705 -p 9001:9001 -v /home/pywork/kod/data/files/dr_py:/root/sd/pywork/dr_py --restart=always --name drpy -d hjdhnx/drpy:amd64-v3.9.0
```
\ No newline at end of file
```
#### 已知兼容性问题记录
1.本地js和远程js相比,本地js的pdfa取列表方法不支持 && 隔开取当前节点
比如 当前为
```html
<ul>
<li></li>
<li></li>
<li></li>
</ul>>
```
那么可以写 ul li,也可以写 li,但是不能写ul&&li,因为 ul:eq(0)&&li在这种情况下获取不到数据 (cheerio模块的问题)
2.远程js不支持 :eq(负数) 这种写法 (我后端修改后只兼容了 :eq(-1),其他负数写法尽量避免)
3.quickjs在armv7架构的设备上通过pip install直接安装的会无法正常运行,需要用本项目whl下的轮子文件进行安装或者
自行编译quickjs仓库的源码再安装
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册