提交 2d20ec3c 编写于 作者: H hjdhnx

优化源的写法和说明文件

上级 3e5614f3
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',
......
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',
......
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',
......
......@@ -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
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册