制作规则需要有html基础。规则用法:
a、attrhref
表示取a
的href
属性,a、attrdata-original
表示取a
的attrdata-original
属性,以此类推;.content_detail>p:nth-child(4)、text、split、:、1
,其中split、:、1
意思是split(":"),后面的1,表示取第二个数组元素,0表示取第一个数组元素;replaceAll、:、
表示将所有:
替换为空;filterBackslash
表示取得反斜杠;unescape
JavaScript的unescape
用法。
- searchUrl:
https://www.gqytv.com/search.php;form:searchword=${name};charset=utf-8
这是表单post请求格式,form:searchword=${name}
中,searchword
是key,name
是搜索视频名;https://www.gqytv.com/search.php?searchword=${name};charset=utf-8
,这是get请求格式 - searchList:
.stui-vodlist li
获取到搜索列表子项的标签 - searchListStart:标签开始位置,0表示第一项
- searchListEnd:标签结束位置,0表示最后一项开始,1表示倒数第二开始
- searchListTitle:
h4>a、text
取搜索列表子项的标签h4
内标签a
的text
使用APP内测试工具进行测试如图:
1.png2.PNG
当规则测试并未如期返回数据时,可以使用dom测试工具检查问题,如图
3.PNG4.PNG
5.png
- searchListUrl:
h4>a、attrhref
取搜索列表子项的标签h4
内标签a
的href
属性 - searchListImg:
a、attrdata-original
取搜索列表子项的标签a
的data-original
属性 - catalogList:
.row>.stui-pannel
获取多个资源目录列表 - catalogTag:
h3>span、text
每个资源目录来源名称 - episodeList:
ul>li
每个资源目录列表 - episodeTitle:
a、text
每个资源目录列表子项的标题名 - episodeUrl:
a、attrhref
每个资源目录列表子项的链接a
的href
属性 - videoUrl:
iframe、attrsrc、split、url=、1
获取iframe
标签src
属性,使用split分割方法将拿到的src属性字符串剪切成数组,0表示取第一个值,1表示取第二个值,以此类推 - stars:
.content_detail>p:nth-child(4)、text、split、:、1
获取class
为content_detail
子项第四个p
的text
文本,、split、:、1
将文本如主演:葛优 黄渤 范伟 邓超 沈腾 张占义 王宝强 徐峥 闫妮 马丽 刘敏
使用split方法分割成['主演','葛优 黄渤 范伟 邓超 沈腾 张占义 王宝强 徐峥 闫妮 马丽 刘敏']
数组,0表示取第一个值,1表示取第二个值,以此类推 - director:导演
- rating:评分
- category:分类
- region:地区
- time:时间
- desc:简介
- isUseDplayer:使用dplayer播放器,以后详细介绍
- videoLinksRules:和navLinksRules一样,
#$.play>.p_list>.p_list_03:nth-child(3)>li:nth-child(2)>a、attrhref
根据页面中链接定向到下一个页面,然后根据videoUrl
属性从下一个页面中获取视频播放链接,以#$
分开,可以定向多个 - videoUrl:获取播放地址,
body iframe、attrsrc、split、url=、1
,从iframe
获取src
属性文本,在使用split分割取第二个值 - customCategoryTagList:自定义分类
- categoryFirstUrl:分类第一个页面链接,也就是第一行
- categoryTagList:通过规则获取分类第一行数组
[{ tag: '电影', url: 'http://www.d1dy.com/vod/show/by/time/id/1.html' }, { tag: '电视剧', url: 'http://www.d1dy.com/vod/show/by/time/id/2.html' }, { tag: '动漫', url: 'http://www.d1dy.com/vod/show/by/time/id/3.html' }, { tag: '综艺', url: 'http://www.d1dy.com/vod/show/by/time/id/4.html' }]
,和customCategoryTagList二选一,本规则使用了customCategoryTagList,所以这里为空值 - categoryTag:
- categoryTagUrl:
- categoryTagListStart:
- categoryTagListEnd:
-
catTypeList:获取三个列表,如下图
截屏2020-11-18 下午7.06.12.png -
catTypeTagList: 获取分类列表,如下图
- catRankList:获取最新和排行分类,如下图
-
catVideoList:获取分类视频列表,如图
- catVideoNextPageUrl:
.text-center>ul>li:eq(-1)>a、attrhref
,获取下一页链接,li:eq(-1)
是列表倒数第二个li
- recommendData:推荐页数据
{
"recommendIndex": 0,
"catIndex": 0,
"points": 5,
"cIndex": 1,
"pIndex": 0,
"iCount": 1,
"vUrl": "https://github.com/YangChenDong/ponpota/blob/main/pc.json",
"rules": [{
"reptileTypeId": 0,
"videoIndex": 2,
"code": "utf-8",
"name": "第一电影",
"baseUrl": "http://www.d1dy.com",
"codeTransform": "utf-8",
"searchUrl": "http://www.d1dy.com/vod/search.html?wd=${name};charset=utf-8",
"searchList": ".vodlist>li",
"searchListStart": 0,
"searchListEnd": 0,
"searchListTitle": ".searchlist_titbox>h4>a、attrtitle",
"searchListUrl": ".searchlist_titbox>h4>a、attrhref",
"searchListImg": ".searchlist_img>a、attrdata-original",
"searchListStars": null,
"searchListDirector": null,
"searchListRating": null,
"searchListCategory": null,
"searchListRegion": null,
"searchListTime": null,
"catalogList": ".Select",
"catalogTag": null,
"catalogListStart": 0,
"catalogListEnd": 0,
"episodeList": "ul>li",
"episodeTitle": "a、text",
"episodeUrl": "a、attrhref",
"episodeListStart": 0,
"stars": ".content_detail>p:nth-child(4)、text、split、:、1",
"director": ".content_detail>p:nth-child(5)、text、split、:、1",
"rating": ".content_detail>.score、text",
"category": ".content_detail>p:nth-child(6)>a:nth-child(8)、text",
"region": ".content_detail>p:nth-child(6)>a:nth-child(5)、text",
"time": ".content_detail>p:nth-child(6)>a:nth-child(2)、text",
"desc": ".content_detail>p:nth-child(8)、text、split、详细、0",
"isStringCutting": false,
"isUseDplayer": false,
"videoLinksRules": null,
"videoBaseUrl": "https://",
"videoUrl": "body iframe、attrsrc、split、url=、1",
"filterTag": null,
"customCategoryTagList": [{
"tag": "电影",
"url": "http://www.d1dy.com/vod/show/by/time/id/1.html"
}, {
"tag": "电视剧",
"url": "http://www.d1dy.com/vod/show/by/time/id/2.html"
}, {
"tag": "动漫",
"url": "http://www.d1dy.com/vod/show/by/time/id/3.html"
}, {
"tag": "综艺",
"url": "http://www.d1dy.com/vod/show/by/time/id/4.html"
}],
"categoryFirstUrl": "http://www.d1dy.com/vod/show/by/time/id/1.html",
"categoryTagList": null,
"categoryTag": null,
"categoryTagUrl": null,
"categoryTagListStart": 0,
"categoryTagListEnd": 0,
"catTypeList": ".classifyWarp>.wrapper_fl",
"catTypeStart": 0,
"catTypeEnd": 0,
"catTypeTagListTag": "li>span、text",
"catTypeTagList": "li",
"catTypeTag": "a、text",
"catTypeTagUrl": "a、attrhref",
"catTypeTagListStart": 2,
"catTypeTagListEnd": 0,
"catRankList": ".container>.wrapper_fl>.screen_list>li",
"catRankTag": "a、text",
"catRankUrl": "a、attrhref",
"catRankListStart": 0,
"catRankListEnd": 0,
"catVideoBaseUrl": null,
"catVideoList": ".panel-max>ul>li",
"catVideoTitle": "h3>a、text",
"catVideoUrl": "h3>a、attrhref",
"catVideoImg": ".vodlist__thumb、attrdata-original",
"catVideoListStart": 0,
"catVideoListEnd": 0,
"catVideoNextPageUrl": ".text-center>ul>li:eq(-1)>a、attrhref",
"recommendData": [{
"title": "豆瓣高分",
"url": "http://www.d1dy.com/vod/show/by/score/id/1.html"
}, {
"title": "热门电视剧",
"url": "http://www.d1dy.com/vod/show/id/2.html"
}, {
"title": "人气动漫",
"url": "http://www.d1dy.com/vod/show/by/score/id/3.html"
}, {
"title": "热门综艺",
"url": "http://www.d1dy.com/vod/show/by/score/id/4.html"
}],
"imageCarouselData": [{
"img": "http://m.iqiyipic.com/common/lego/20201011/5ed5569913c04f9a976f509f99b89ca1.jpg",
"title": "半糖"
}, {
"img": "http://m.iqiyipic.com/common/lego/20201010/e87ec978d9c5412c9aff94bde36f2850.jpg",
"title": "越过山丘"
}, {
"img": "https://puui.qpic.cn/tv/0/1223518009_1080607/0?max_age=7776000",
"title": "甜了青梅配竹马"
}]
}],
"hotSearchData": [{
"keyword": "流浪地球"
}, {
"keyword": "印度合作人"
}, {
"keyword": "大江大河"
}, {
"keyword": "蛋炒饭"
}, {
"keyword": "活埋"
}]
}
网友评论