From 2d20ec3cbd7037fa50fad879bd5c86b61dfb7c0e Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Fri, 26 Aug 2022 13:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=BA=90=E7=9A=84=E5=86=99?= =?UTF-8?q?=E6=B3=95=E5=92=8C=E8=AF=B4=E6=98=8E=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "js/555\345\275\261\350\247\206.js" | 9 ++++-- ...35\350\216\223\345\275\261\350\247\206.js" | 5 ++-- "js/\351\270\255\345\245\210\351\243\236.js" | 6 ++-- models/cms.py | 13 +++++---- readme.md | 29 ++++++++++++++++++- 5 files changed, 48 insertions(+), 14 deletions(-) diff --git "a/js/555\345\275\261\350\247\206.js" "b/js/555\345\275\261\350\247\206.js" index 0e151c7..0df8224 100644 --- "a/js/555\345\275\261\350\247\206.js" +++ "b/js/555\345\275\261\350\247\206.js" @@ -1,8 +1,13 @@ var rule = { title:'555影视', - url:'https://www.5dy5.cc/vodshow/fyclass--------fypage---.html', + host:'https://www.5dy5.cc', + // homeUrl:'/', + url:'/vodshow/fyclass--------fypage---.html', searchUrl:'/vodsearch/**----------fypage---.html', - ua:'MOBILE_UA', + headers:{//网站的请求头,完整支持所有的,常带ua和cookies + 'User-Agent':'MOBILE_UA', + "Cookie": "searchneed=ok" + }, class_name:'电影&连续剧&福利&动漫&综艺', class_url:'1&2&124&4&3', 一级:'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href', diff --git "a/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" "b/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" index 92fd79e..9ae1c3a 100644 --- "a/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" +++ "b/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" @@ -1,8 +1,9 @@ var rule = { title:'蓝莓影视', - url:'https://lanmeiguojiang.com/show/fyclass--------fypage---.html', + host:'https://lanmeiguojiang.com', + // homeUrl:'/', + url:'/show/fyclass--------fypage---.html', searchUrl:'/vodsearch/**----------fypage---.html', - ua:'MOBILE_UA', class_name:'电影&网剧&剧集&动漫&综艺&记录', class_url:'20&1&2&3&4&23', 一级:'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href', diff --git "a/js/\351\270\255\345\245\210\351\243\236.js" "b/js/\351\270\255\345\245\210\351\243\236.js" index 830a77e..c15807f 100644 --- "a/js/\351\270\255\345\245\210\351\243\236.js" +++ "b/js/\351\270\255\345\245\210\351\243\236.js" @@ -1,10 +1,10 @@ var rule = { title:'鸭奈飞', - url:'https://yanetflix.com/vodshow/fyclass--------fypage---.html', + host:'https://yanetflix.com', + // homeUrl:'/', + url:'/vodshow/fyclass--------fypage---.html', detailUrl:'https://yanetflix.com/voddetail/fyid.html',//非必填 - // url:'https://yanetflix.com/vodshow/', searchUrl:'/vodsearch/**----------fypage---.html', - ua:'MOBILE_UA', class_name:'电影&连续剧&综艺&动漫', class_url:'dianying&lianxuju&zongyi&dongman', 一级:'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href', diff --git a/models/cms.py b/models/cms.py index 6ded232..2267857 100644 --- a/models/cms.py +++ b/models/cms.py @@ -14,7 +14,7 @@ class CMS: def __init__(self,rule): host = rule.get('host','').rstrip('/') timeout = rule.get('timeout',2000) - homeUrl = rule.get('homeUrl','') + homeUrl = rule.get('homeUrl','/') url = rule.get('url','') detailUrl = rule.get('detailUrl','') searchUrl = rule.get('searchUrl','') @@ -116,7 +116,7 @@ class CMS: 'type_id': class_urls[i] }) # print(self.url) - if self.homeUrl and self.class_parse: + if self.homeUrl.startswith('http') and self.class_parse: # print(self.homeUrl) # print(self.class_parse) try: @@ -204,7 +204,6 @@ class CMS: "vod_remarks": desc, "vod_content": content, }) - print(videos) result['list'] = videos result['page'] = fypage result['pagecount'] = 9999 @@ -364,14 +363,16 @@ class CMS: if __name__ == '__main__': from utils import parser - js_path = f'js/玩偶姐姐.js' + # js_path = f'js/玩偶姐姐.js' + js_path = f'js/蓝莓影视.js' ctx, js_code = parser.runJs(js_path) rule = ctx.eval('rule') cms = CMS(rule) print(cms.title) - # print(cms.homeContent()) + print(cms.homeContent()) + print(cms.categoryContent('20',1)) # print(cms.categoryContent('latest',1)) - print(cms.detailContent(['https://hongkongdollvideo.com/video/b22c7cb6df40a3c4.html'])) + # print(cms.detailContent(['https://hongkongdollvideo.com/video/b22c7cb6df40a3c4.html'])) # cms.categoryContent('dianying',1) # print(cms.detailContent(['67391'])) # print(cms.searchContent('斗罗大陆')) \ No newline at end of file diff --git a/readme.md b/readme.md index 8e0f2e1..54531ac 100644 --- a/readme.md +++ b/readme.md @@ -13,4 +13,31 @@ 并且pluto要自己切换路径为PlutoPlayer ### 相关教程 -[pyquery定位](https://blog.csdn.net/Arise007/article/details/79513094) \ No newline at end of file +[pyquery定位](https://blog.csdn.net/Arise007/article/details/79513094) + +### 模板规则说明 +所有相关属性说明 +```javascript +var rule = { + title:'',//规则标题,没有实际作用,但是可以作为cms类名称依据 + host:'',//网页的域名根,包含http头如 https://www,baidu.com + homeUrl:'/latest/',//网站的首页链接,可以是完整路径或者相对路径,用于分类获取和推荐获取 fyclass是分类标签 fypage是页数 + url:'/fyclass/fypage.html[/fyclass/]',//网站的分类页面链接 + detailUrl:'https://yanetflix.com/voddetail/fyid.html',//非必填,二级详情拼接链接,感觉没啥卵用 + searchUrl:'',//搜索链接 可以是完整路径或者相对路径,用于分类获取和推荐获取 **代表搜索词 fypage代表页数 + headers:{//网站的请求头,完整支持所有的,常带ua和cookies + 'User-Agent':'MOBILE_UA', + "Cookie": "searchneed=ok" + }, + timeout:5000,//网站的全局请求超时,默认是2000毫秒 + //动态分类获取 列表;标题;链接;正则提取 不需要正则的时候后面别加分号 + class_parse:'#side-menu:lt(1) li;a&&Text;a&&href;com/(.*?)/', + // 类似海阔一级 列表;标题;图片;描述;链接;详情 其中最后一个参数选填 + 一级:'.col-sm-6;h3&&Text;img&&data-src;.date&&Text;a&&href', + // 二级可以是*,表示规则无二级,直接拿一级的链接进行嗅探 + // 或者 {title:'',img:'',desc:'',content:'',tabs:'',lists:''} 同海阔dr二级 + 二级:'*', + // 搜索可以是*,集成一级,或者跟一级一样的写法 列表;标题;图片;描述;链接;详情 + 搜索:'*', +} +``` \ No newline at end of file -- GitLab