diff --git a/base/rules.db b/base/rules.db index 8a503d3657320f471a0335c39c461d2716c4b710..8579e1d50696c9b01a66654ccb3e03aef629c1f2 100644 Binary files a/base/rules.db and b/base/rules.db differ diff --git a/controllers/cms.py b/controllers/cms.py index fa6fb4161bf23c8e78c3d90f1c46c48aa34659de..b09996c923b33e057b34a22be07289682579d259 100644 --- a/controllers/cms.py +++ b/controllers/cms.py @@ -1048,7 +1048,7 @@ class CMS: if is_json: html = self.dealJson(html) html = json.loads(html) - # print(html) + print(html) if not is_json and html.find('输入验证码') > -1: cookie = verifyCode(url,self.headers,self.timeout,self.retry_count,self.ocr_api) # cookie = '' @@ -1063,14 +1063,15 @@ class CMS: html = r.text items = pdfa(html,p[0].replace('json:','',1)) - # print(items) + print(len(items),items) videos = [] for item in items: # print(item) try: # title = pdfh(item, p[1]) - title =''.join([pdfh(item, i) for i in p[1].split('||')]) - + print(p[1].split('||')) + title = ''.join([pdfh(item, i) for i in p[1].split('||')]) + print(title) try: img = pd(item, p[2]) except: @@ -1095,7 +1096,8 @@ class CMS: "vod_remarks": desc, "vod_content": content, # 无用参数 }) - except: + except Exception as e: + print(e) pass # print(videos) except Exception as e: diff --git "a/js/\350\277\275\345\211\247\345\226\265.js" "b/js/\350\277\275\345\211\247\345\226\265.js" index 18f314da830a716080fa5adb85b2df605485dda9..9a6f989a70a2a7c009675c213cae001b17e4251a 100644 --- "a/js/\350\277\275\345\211\247\345\226\265.js" +++ "b/js/\350\277\275\345\211\247\345\226\265.js" @@ -2,4 +2,5 @@ var rule = Object.assign(muban.海螺2,{ title:'追剧喵', host:'https://zjmiao.com', + 搜索:'.search-list;a&&Text;.lazy&&data-original;.deployment&&Text;a&&href', }); \ No newline at end of file diff --git a/utils/htmlParser.py b/utils/htmlParser.py index f2fadaf306af14e78ab11f16aee571cba458946d..f94dfadda147173abc3c447e75ec7152286dca88 100644 --- a/utils/htmlParser.py +++ b/utils/htmlParser.py @@ -22,6 +22,7 @@ class jsoup: def pdfh(self,html,parse:str,add_url=False): if not parse: return '' + doc = pq(html) option = None if parse.find('&&') > -1: @@ -32,8 +33,9 @@ class jsoup: else: parse = parse[0] if self.test(':eq|:lt|:gt|#',parse[0]) else f'{parse[0]}:eq(0)' # FIXME 暂时不支持jsonpath那样的|| 分割取或属性 + if option: - # print(f'parse:{parse}=>(option:{option})') + print(f'parse:{parse}=>(option:{option})') ret = doc(parse) # print(html) # FIXME 解析出来有多个的情况应该自动取第一个 @@ -42,8 +44,8 @@ class jsoup: elif option == 'Html': ret = ret.html() else: - ret = ret.attr(option) - if add_url and option in ['url','src','href','data-original','data-src']: + ret = ret.attr(option) or '' + if ret and add_url and option in ['url','src','href','data-original','data-src']: if 'http' in ret: ret = ret[ret.find('http'):] else: