提交 28df734c 编写于 作者: H hjdhnx

升级版本并增加了新特性

上级 b1541869
无法预览此类型文件
......@@ -977,10 +977,13 @@ class CMS:
# print(str(etree.tostring(vHeader[0], pretty_print=True), 'utf-8'))
from lxml.html import tostring as html2str
# print(html2str(vHeader[0].root).decode('utf-8'))
tab_text = p.get('tab_text','') or 'body&&Text'
# print('tab_text:'+tab_text)
if not is_json:
for v in vHeader:
# 过滤排除掉线路标题
v_title = pq(v).text()
# v_title = pq(v).text()
v_title = pdfh(v,tab_text).strip()
# print(v_title)
if self.tab_exclude and jsp.test(self.tab_exclude, v_title):
continue
......@@ -1017,24 +1020,30 @@ class CMS:
vod_play_url = vod_play_url.join(list(map(lambda x:'#'.join(x),vlists)))
else:
list_text = p.get('list_text','') or 'body&&Text'
list_url = p.get('list_url','') or 'a&&href'
print('list_text:' + list_text)
print('list_url:' + list_url)
is_tab_js = p['tabs'].strip().startswith('js:')
for i in range(len(vodHeader)):
tab_name = str(vodHeader[i])
# print(tab_name)
tab_ext = p['tabs'].split(';')[1] if len(p['tabs'].split(';')) > 1 else ''
tab_ext = p['tabs'].split(';')[1] if len(p['tabs'].split(';')) > 1 and not is_tab_js else ''
p1 = p['lists'].replace('#idv', tab_name).replace('#id', str(i))
tab_ext = tab_ext.replace('#idv', tab_name).replace('#id', str(i))
# print(p1)
vodList = pdfa(html, p1) # 1条线路的选集列表
# print(vodList)
# vodList = [pq(i).text()+'$'+pd(i,'a&&href') for i in vodList] # 拼接成 名称$链接
# pq(i).text()
if self.play_parse: # 自动base64编码
vodList = [(pdfh(html, tab_ext) if tab_ext else tab_name) + '$' + self.play_url + encodeUrl(i) for i
in vodList] if is_json else \
[pq(i).text() + '$' + self.play_url + encodeUrl(pd(i, 'a&&href')) for i in vodList] # 拼接成 名称$链接
[pdfh(i,list_text) + '$' + self.play_url + encodeUrl(pd(i, list_url)) for i in vodList] # 拼接成 名称$链接
else:
vodList = [(pdfh(html, tab_ext) if tab_ext else tab_name) + '$' + self.play_url + i for i in
vodList] if is_json else \
[pq(i).text() + '$' + self.play_url + pd(i, 'a&&href') for i in vodList] # 拼接成 名称$链接
[pdfh(i,list_text) + '$' + self.play_url + pd(i, list_url) for i in vodList] # 拼接成 名称$链接
vlist = '#'.join(vodList) # 拼多个选集
vod_tab_list.append(vlist)
vod_play_url = vod_play_url.join(vod_tab_list)
......
3.9.11beta5
\ No newline at end of file
3.9.12
\ No newline at end of file
......@@ -1598,12 +1598,13 @@ function detailParse(detailObj){
playFrom = TABS;
}else{
let p_tab = p.tabs.split(';')[0];
console.log(p_tab);
// console.log(p_tab);
let vHeader = _pdfa(html, p_tab);
console.log(vHeader.length);
let tab_text = p.tab_text||'body&&Text';
// print('tab_text:'+tab_text);
for(let v of vHeader){
let v_title = _pdfh(v,'body&&Text').trim();
let v_title = _pdfh(v,tab_text).trim();
console.log(v_title);
if(tab_exclude&& (new RegExp(tab_exclude)).test(v_title)){
continue;
......@@ -1630,9 +1631,14 @@ function detailParse(detailObj){
eval(p.lists.replace('js:',''));
vod_play_url = LISTS.map(it=>it.join('#')).join(vod_play_url);
}else{
let list_text = p.list_text||'body&&Text';
let list_url = p.list_url||'a&&href';
// print('list_text:'+list_text);
// print('list_url:'+list_url);
let is_tab_js = p.tabs.trim().startsWith('js:');
for(let i=0;i<playFrom.length;i++){
let tab_name = playFrom[i];
let tab_ext = p.tabs.split(';').length > 1 ? p.tabs.split(';')[1] : '';
let tab_ext = p.tabs.split(';').length > 1 && !is_tab_js ? p.tabs.split(';')[1] : '';
let p1 = p.lists.replaceAll('#idv', tab_name).replaceAll('#id', i);
tab_ext = tab_ext.replaceAll('#idv', tab_name).replaceAll('#id', i);
console.log(p1);
......@@ -1645,6 +1651,7 @@ function detailParse(detailObj){
// console.log(e.message);
}
let new_vod_list = [];
// print('tab_ext:'+tab_ext);
let tabName = tab_ext?_pdfh(html, tab_ext):tab_name;
console.log(tabName);
// console.log('cheerio解析Text');
......@@ -1652,7 +1659,8 @@ function detailParse(detailObj){
// 请注意,这里要固定pdfh解析body&&Text,不需要下划线,没写错
// new_vod_list.push(pdfh(it,'body&&Text')+'$'+_pd(it,'a&&href',MY_URL));
// new_vod_list.push(cheerio.load(it).text()+'$'+_pd(it,'a&&href',MY_URL));
new_vod_list.push(_pdfh(it, 'body&&Text').trim() + '$' + _pd(it, 'a&&href', MY_URL));
// new_vod_list.push(_pdfh(it, list_text).trim() + '$' + _pd(it, list_url, MY_URL));
new_vod_list.push(_pdfh(it, list_text).trim() + '$' + _pd(it, list_url, MY_URL));
});
let vlist = new_vod_list.join('#');
vod_tab_list.push(vlist);
......
此差异已折叠。
......@@ -50,6 +50,7 @@
###### 2022/10/20
- [X] 新增了几个源
- [X] 修复乐猪TV源并记录已知问题
- [X] 升级版本至:3.9.12 二级增加新特性 tab_text:'body&&Text',list_text:'body&&Text',list_url:'a&&href'
###### 2022/10/19
- [X] 源增加 filter_def 属性用于指定不同分类下的默认筛选条件
- [X] 修改搭建文档给出armv7设备的drpy运行兼容方案
......@@ -371,7 +372,7 @@ var rule = {
// 二级可以是*,表示规则无二级,直接拿一级的链接进行嗅探
// 二级 title: 片名;类型
// 二级 desc: 主要信息;年代;地区;演员;导演
// 或者 {title:'',img:'',desc:'',content:'',tabs:'',lists:''} 同海阔dr二级
// 或者 {title:'',img:'',desc:'',content:'',tabs:'',lists:'',tab_text:'body&&Text',list_text:'body&&Text',list_url:'a&&href'} 同海阔dr二级
二级:'*',
// 搜索可以是*,集成一级,或者跟一级一样的写法 列表;标题;图片;描述;链接;详情
搜索:'*',
......
......@@ -24,6 +24,11 @@ class jsoup:
if not parse:
return ''
doc = pq(html)
if parse == 'body&&Text' or parse == 'Text':
text = doc.text()
return text
elif parse == 'body&&Html' or parse == 'Html':
return doc.html()
option = None
if parse.find('&&') > -1:
option = parse.split('&&')[-1]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册