diff --git a/base/custom.conf b/base/custom.conf index 68060fb1769f207c4e15001396e91744335cc5a6..9fa716b286fbc28ad3feba1a497c2934d978f03c 100644 --- a/base/custom.conf +++ b/base/custom.conf @@ -15,6 +15,34 @@ "quickSearch":1, "filterable":0 }, + # 缓存js + +{"key": "dr_1080P", "name": "1080P(道长)", "type": 1, "api": "{{host}}/vod?rule=1080P&ext=txt/js/tg/1080P.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_MXONE", "name": "MXONE(道长)", "type": 1, "api": "{{host}}/vod?rule=MXONE&ext=txt/js/tg/MXONE.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_Nike影视", "name": "Nike影视(道长)", "type": 1, "api": "{{host}}/vod?rule=Nike影视&ext=txt/js/tg/Nike影视.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_TV云播", "name": "TV云播(道长)", "type": 1, "api": "{{host}}/vod?rule=TV云播&ext=txt/js/tg/TV云播.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_两个BT", "name": "两个BT(道长)", "type": 1, "api": "{{host}}/vod?rule=两个BT&ext=txt/js/tg/两个BT.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_乐猪TV", "name": "乐猪TV(道长)", "type": 1, "api": "{{host}}/vod?rule=乐猪TV&ext=txt/js/tg/乐猪TV.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_剧荒", "name": "剧荒(道长)", "type": 1, "api": "{{host}}/vod?rule=剧荒&ext=txt/js/tg/剧荒.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_剧迷", "name": "剧迷(道长)", "type": 1, "api": "{{host}}/vod?rule=剧迷&ext=txt/js/tg/剧迷.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_大师兄影视", "name": "大师兄影视(道长)", "type": 1, "api": "{{host}}/vod?rule=大师兄影视&ext=txt/js/tg/大师兄影视.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_天空影视", "name": "天空影视(道长)", "type": 1, "api": "{{host}}/vod?rule=天空影视&ext=txt/js/tg/天空影视.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_完美看看", "name": "完美看看(道长)", "type": 1, "api": "{{host}}/vod?rule=完美看看&ext=txt/js/tg/完美看看.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_快云影院", "name": "快云影院(道长)", "type": 1, "api": "{{host}}/vod?rule=快云影院&ext=txt/js/tg/快云影院.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_爱看影视", "name": "爱看影视(道长)", "type": 1, "api": "{{host}}/vod?rule=爱看影视&ext=txt/js/tg/爱看影视.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_爱看电影", "name": "爱看电影(道长)", "type": 1, "api": "{{host}}/vod?rule=爱看电影&ext=txt/js/tg/爱看电影.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_特狗影视", "name": "特狗影视(道长)", "type": 1, "api": "{{host}}/vod?rule=特狗影视&ext=txt/js/tg/特狗影视.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_皮皮泡", "name": "皮皮泡(道长)", "type": 1, "api": "{{host}}/vod?rule=皮皮泡&ext=txt/js/tg/皮皮泡.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_看了么", "name": "看了么(道长)", "type": 1, "api": "{{host}}/vod?rule=看了么&ext=txt/js/tg/看了么.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_胖虎影视", "name": "胖虎影视(道长)", "type": 1, "api": "{{host}}/vod?rule=胖虎影视&ext=txt/js/tg/胖虎影视.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_18av", "name": "18av(道长)", "type": 1, "api": "{{host}}/vod?rule=18av&ext=txt/js/18/18av.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_banan", "name": "banan(道长)", "type": 1, "api": "{{host}}/vod?rule=banan&ext=txt/js/18/banan.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_Missav", "name": "Missav(道长)", "type": 1, "api": "{{host}}/vod?rule=Missav&ext=txt/js/18/Missav.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_养端", "name": "养端(道长)", "type": 1, "api": "{{host}}/vod?rule=养端&ext=txt/js/18/养端.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_吸瓜", "name": "吸瓜(道长)", "type": 1, "api": "{{host}}/vod?rule=吸瓜&ext=txt/js/18/吸瓜.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_朱古力", "name": "朱古力(道长)", "type": 1, "api": "{{host}}/vod?rule=朱古力&ext=txt/js/18/朱古力.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, +{"key": "dr_玩偶姐姐", "name": "玩偶姐姐(道长)", "type": 1, "api": "{{host}}/vod?rule=玩偶姐姐&ext=txt/js/18/玩偶姐姐.js", "searchable": 2, "quickSearch": 0, "filterable": 0}, + {"key":"csp_SP360","name":"🎾360(SP)","type":3,"api":"csp_SP360","searchable":1,"quickSearch":1,"filterable":1}, {"key":"csp_Kuaikan","name":"👀快看(SP)","type":3,"api":"csp_Kuaikan","searchable":1,"quickSearch":1,"filterable":1}, {"key":"csp_Kunyu77","name":"👒七七(SP)","type":3,"api":"csp_Kunyu77","searchable":1,"quickSearch":1,"filterable":1}, diff --git a/base/rules.db b/base/rules.db index aa53453a8600abd82c8fb517567065af4199f7e7..be67b0eefe7fc503ec9bd198a84efebd4b79b1f9 100644 Binary files a/base/rules.db and b/base/rules.db differ diff --git a/controllers/admin.py b/controllers/admin.py index 7358fcedfd63b5b958814d47ff9896e08471f963..6d8e473a8d0c894c7cbf9e9533126e4a284eb709 100644 --- a/controllers/admin.py +++ b/controllers/admin.py @@ -11,7 +11,7 @@ from base.R import R from utils.update import getLocalVer,getOnlineVer,download_new_version,download_lives,copy_to_update from utils import parser from utils.web import getParmas,verfy_token -from js.rules import getRules +from js.rules import getRules,getCacheCount from utils.parser import runJScode from werkzeug.utils import secure_filename from utils.web import md5 @@ -35,7 +35,8 @@ def admin_index(): # 管理员界面 live_url = lsg.getItem('LIVE_URL') use_py = lsg.getItem('USE_PY') # print(f'live_url:', live_url) - return render_template('admin.html', pystate=use_py,rules=getRules('js'), ver=getLocalVer(), live_url=live_url) + cache_count = getCacheCount() + return render_template('admin.html', pystate=use_py,rules=getRules('js'),cache_count=cache_count, ver=getLocalVer(), live_url=live_url) @admin.route('/settings') def admin_settings(): # 管理员界面 diff --git a/controllers/home.py b/controllers/home.py index e1b93ddeeea5b59285b6128bfe58638657cfb6fd..943a7a321c975d7d1e39dc5e130acf7cbb5aeb62 100644 --- a/controllers/home.py +++ b/controllers/home.py @@ -6,23 +6,24 @@ import json import os + from flask import Blueprint,abort,render_template,render_template_string,url_for,redirect,make_response,send_from_directory from controllers.service import storage_service from controllers.classes import getClasses,getClassInfo -from utils.web import getParmas -from utils.files import getPics,custom_merge + +from utils.files import getPics,custom_merge,getAlist,get_live_url,get_multi_rules,getCustonDict from js.rules import getRules,getPys +from utils.encode import parseText from base.R import R from utils.system import getHost,is_linux from utils.cfg import cfg from utils import parser from utils.log import logger -from utils.files import getAlist,get_live_url,get_multi_rules from utils.update import getLocalVer,getHotSuggest -from utils.encode import parseText -from utils.files import getCustonDict from js.rules import getJxs import random +from utils.web import getParmas + home = Blueprint("home", __name__,static_folder='/static') diff --git a/controllers/vod.py b/controllers/vod.py index f201733f3d80eb37b35b7f4adb7d735e5015d086..9e67e73907d2a5503bd6c9e2433190f63dc4260c 100644 --- a/controllers/vod.py +++ b/controllers/vod.py @@ -146,15 +146,18 @@ def vod_home(): filters = getParmas('f') tp = getParmas('type') # print(f'type:{tp}') - if not ext.startswith('http') and not rule: + # if not ext.startswith('http') and not rule: + if not rule: return R.failed('规则字段必填') rule_list = getRuleLists() - if not ext.startswith('http') and not rule in rule_list: + # if not ext.startswith('http') and not rule in rule_list: + if not ext and not rule in rule_list: msg = f'服务端本地仅支持以下规则:{",".join(rule_list)}' return R.failed(msg) # logger.info(f'检验耗时:{get_interval(t0)}毫秒') t1 = time() - js_path = f'js/{rule}.js' if not ext.startswith('http') else ext + # js_path = f'js/{rule}.js' if not ext.startswith('http') else ext + js_path = f'js/{rule}.js' if not ext else ext with open('js/模板.js', encoding='utf-8') as f: before = f.read() # logger.info(f'js读取耗时:{get_interval(t1)}毫秒') diff --git a/js/rules.py b/js/rules.py index 9c5eef58e4e571dc9e14da444cf9e79399305e7a..a1c4c3c8b45852091502526a97481d64e3415227 100644 --- a/js/rules.py +++ b/js/rules.py @@ -3,12 +3,13 @@ # File : rules.py.py # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ # Date : 2022/8/25 - +import json import os from time import time import js2py from utils.log import logger -from utils.web import get_interval,UA +# from utils.web import get_interval,UA +from utils.ua import UA,get_interval def getRuleLists(): base_path = os.path.dirname(os.path.abspath(__file__)) # 当前文件所在目录 @@ -20,6 +21,13 @@ def getRuleLists(): # print(rule_list) return rule_list +def getCacheCount(): + base_path = 'cache/' # 当前缓存js所在目录 + os.makedirs(base_path, exist_ok=True) + file_name = os.listdir(base_path) + file_name = list(filter(lambda x: str(x).endswith('.js') and str(x).find('模板') < 0, file_name)) + return len(file_name) + def getRules(path='cache'): t1 = time() base_path = path+'/' # 当前文件所在目录 @@ -135,5 +143,38 @@ def getPys(path='txt/py'): logger.info(f'自动加载Pyramid耗时:{get_interval(t1)}毫秒') return new_rule_list +def gen_cache(path='txt/js/tg'): + t1 = time() + base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录 + py_path = os.path.join(base_path, path) + os.makedirs(py_path, exist_ok=True) + file_name = os.listdir(py_path) + file_name = list(filter(lambda x: str(x).endswith('.js'), file_name)) + # print(file_name) + rule_list = [file.replace('.js', '') for file in file_name] + js_path = [f'{path}/{rule}.js' for rule in rule_list] + new_rule_list = [] + for i in range(len(rule_list)): + # print(js_path[i]) + rname = rule_list[i] + new_rule_list.append( + { + "key": f"dr_{rname}", + "name": f"{rname}(道长)", + "type": 1, + # "api": "{{host}}"+f"/vod?rule={rname}&ext="+"{{host}}/"+js_path[i], + "api": "{{host}}"+f"/vod?rule={rname}&ext="+js_path[i], + "searchable": 2, + "quickSearch": 0, + "filterable": 0 + }) + logger.info(f'自动加载{len(new_rule_list)}个缓存JS耗时:{get_interval(t1)}毫秒') + new_rules_texts = [json.dumps(new_rule,ensure_ascii=False) for new_rule in new_rule_list] + # new_rules_text = json.dumps(new_rule_list,ensure_ascii=False) + new_rules_text = ',\n'.join(new_rules_texts)+',' + return new_rules_text + if __name__ == '__main__': - print(getRuleLists()) \ No newline at end of file + print(getRuleLists()) + print(gen_cache()) + print(gen_cache('txt/js/18')) \ No newline at end of file diff --git a/js/version.txt b/js/version.txt index a7b08398cdb8b35bf1cf4d1314958364189dbfe1..37a142c49b2ab5dacd6796d7fda2b15d855b6871 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.6.13 \ No newline at end of file +3.6.14 \ No newline at end of file diff --git a/readme.md b/readme.md index 21b03e5239fc37766b3a1657402388bd6e40e487..dcba818234438eb9b8260cf078cca05549bbdd5f 100644 --- a/readme.md +++ b/readme.md @@ -46,6 +46,8 @@ [dockerfile教程](https://blog.csdn.net/qq_46158060/article/details/125718218) [获取本地设备信息](https://blog.csdn.net/cui_yonghua/article/details/125508991) [获取本地设备信息](https://m.jb51.net/article/140716.htm) +###### 2022/09/19 +- [X] 1.增加20多个缓存源,需要在custom.conf文件自定义添加 ###### 2022/09/17 - [X] 1.pluto1.5.1最新beta版支持drpy首页推荐点击跳drpy内部聚搜(原理同T4) - [X] 2.pluto1.5.1最新beta版支持searchable为2的源忽略参与聚搜,正常单一搜索 diff --git a/templates/admin.html b/templates/admin.html index e67e5bcd91ab8b56520c4b06a9686e08d64fc68c..6534b8f3a143792c7c5fd2451ffa312e2d8eccca 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -217,7 +217,7 @@ function getFileSize(fileObj) {

-

规则列表数据-共{{rules.count}}条

+

规则列表数据-共{{rules.count+cache_count}}条(内置:{{rules.count}} 缓存:{{cache_count}})

{% if rules.count < 1 %}

暂无内置的规则

{% endif %} diff --git a/txt/js/18/18av.js b/txt/js/18/18av.js new file mode 100644 index 0000000000000000000000000000000000000000..c69316c0ea7ebeb6cf1bf826ebdd0253e1216831 --- /dev/null +++ b/txt/js/18/18av.js @@ -0,0 +1,19 @@ +var rule = { + title:'18av', + host:'https://maa1812.com', + url:'/zh/fyclass/all/fypage.html', + headers:{ + 'User-Agent':'MOBILE_UA' + }, + timeout:5000, + class_name:'最近更新',//静态分类名称拼接 + class_url:'chinese_list',//静态分类标识拼接 + //class_parse:'ul.animenu__nav&&li;a&&Text;a&&href', + limit:5, + play_parse:true, + lazy:'', + 一级:'.posts div;.meta&&Text;img&&src;.top&&Text;a&&href', + 二级:'*', + +} + diff --git a/txt/js/18/Missav.js b/txt/js/18/Missav.js new file mode 100644 index 0000000000000000000000000000000000000000..5ef9b5c2cbd5ea54c1796d8b6c8d37cce3c7bafc --- /dev/null +++ b/txt/js/18/Missav.js @@ -0,0 +1,22 @@ +var rule = { + title:'Missav', + host:'https://missav.com', + searchUrl:'/cn/search/**', + url:'/cn/fyclass?page=fypage', + headers:{ + 'User-Agent':'MOBILE_UA' + }, + timeout:5000, + class_name:'最近更新&新作上市&无码流出&SIRO&LUXU&GANA&PRESTIGE&S-CUTE&ARA&FC2&麻豆传媒&本月热门',//静态分类名称拼接 + class_url:'new&release&uncensored-leak&siro&luxu&gana&maan&scute&ara&fc2&madou&monthly-hot',//静态分类标识拼接 + limit:5, + play_parse:true, + lazy:'', + 一级:'.grid.grid-cols-2 div&&a;.lozad.w-full&&alt;.lozad.w-full&&data-src;.absolute.bottom-1&&Text;a&&href', + 二级:'*', + 搜索:'.grid.grid-cols-2 div&&a;.lozad.w-full&&alt;.lozad.w-full&&data-src;.absolute.bottom-1&&Text;a&&href', + searchable:1,//是否启用全局搜索, + quickSearch:1,//是否启用快速搜索, + filterable:0,//是否启用分类筛选, +} + diff --git a/txt/js/18/banan.js b/txt/js/18/banan.js new file mode 100644 index 0000000000000000000000000000000000000000..d3befc6fc3f958814185785196fdc407891865f3 --- /dev/null +++ b/txt/js/18/banan.js @@ -0,0 +1,19 @@ +var rule = { + title:'banan', + host:'https://banan.tv', + url:'/vodtype/fyclass-fypage.html', + headers:{ + 'User-Agent':'MOBILE_UA' + }, + timeout:5000, + class_name:'探花&91大神&素人&国产&高清&FC2',//静态分类名称拼接 + class_url:'57&23&63&25&22&28',//静态分类标识拼接 + //class_parse:'ul.navbar-nav&&li:gt(1):lt(6);a&&Text;a&&href', + limit:5, + play_parse:true, + lazy:'', + 一级:'.img-box.cover-md&&a;img&&alt;img&&data-src;.grid_date&&Text;a&&href', + 二级:'*', + +} + diff --git "a/js/\345\205\273\347\253\257.jsd" "b/txt/js/18/\345\205\273\347\253\257.js" similarity index 100% rename from "js/\345\205\273\347\253\257.jsd" rename to "txt/js/18/\345\205\273\347\253\257.js" diff --git "a/js/\345\220\270\347\223\234.jsd" "b/txt/js/18/\345\220\270\347\223\234.js" similarity index 100% rename from "js/\345\220\270\347\223\234.jsd" rename to "txt/js/18/\345\220\270\347\223\234.js" diff --git "a/txt/js/18/\346\234\261\345\217\244\345\212\233.js" "b/txt/js/18/\346\234\261\345\217\244\345\212\233.js" new file mode 100644 index 0000000000000000000000000000000000000000..a9a1ffb264a53502784e0526d4e5937a14f71668 --- /dev/null +++ "b/txt/js/18/\346\234\261\345\217\244\345\212\233.js" @@ -0,0 +1,17 @@ +var rule = { + title:'朱古力', + host:'https://pigav.com', + url:'/fyclass/page/fypage', + headers:{ + 'User-Agent':'MOBILE_UA' + }, + timeout:5000, + class_name:'最新&熱門&每日&精選',//静态分类名称拼接 + class_url:'最新av線上看&熱門av線上看&每日av線上看線上看&精選av線上看',//静态分类标识拼接 + limit:5, + play_parse:true, + lazy:'', + 一级:'.l-post div&&a;a&&title;span&&data-bgsrc;.absolute.bottom-1&&Text;a&&href', + 二级:'*', +} + diff --git "a/js/\347\216\251\345\201\266\345\247\220\345\247\220.jsd" "b/txt/js/18/\347\216\251\345\201\266\345\247\220\345\247\220.js" similarity index 100% rename from "js/\347\216\251\345\201\266\345\247\220\345\247\220.jsd" rename to "txt/js/18/\347\216\251\345\201\266\345\247\220\345\247\220.js" diff --git a/txt/js/tg/1080P.js b/txt/js/tg/1080P.js new file mode 100644 index 0000000000000000000000000000000000000000..49109713629ce6a284d4820c933ef28cb2e0249f --- /dev/null +++ b/txt/js/tg/1080P.js @@ -0,0 +1,7 @@ +var rule = Object.assign(muban.mxpro,{ +title:'1080P.', +host:'https://1080p.tv', +url:'/vodshow/fyclass--------fypage---/', +searchUrl:'/search-**----------fypage---/', +class_parse:'.navbar-items li:gt(1):lt(7);a&&Text;a&&href;.*v/(.*?)/', +}); diff --git a/txt/js/tg/MXONE.js b/txt/js/tg/MXONE.js new file mode 100644 index 0000000000000000000000000000000000000000..99cf7c2d112712893cd63ca74bc0b0d6000cf64c --- /dev/null +++ b/txt/js/tg/MXONE.js @@ -0,0 +1,9 @@ +var rule = Object.assign(muban.mxpro,{ + title:'MXONE', + host:'https://www.jpys.me', + url:'vodshow/fyclass--------fypage---.html', + searchUrl:'/vodsearch/**----------fypage---.html/', + class_name:'电影&电视剧&动漫&综艺', + class_url:'1&2&3&4', + class_parse:'', +}); \ No newline at end of file diff --git "a/txt/js/tg/Nike\345\275\261\350\247\206.js" "b/txt/js/tg/Nike\345\275\261\350\247\206.js" new file mode 100644 index 0000000000000000000000000000000000000000..fdf379ebfeff5b46c9ff21c3163553aecdbf16e9 --- /dev/null +++ "b/txt/js/tg/Nike\345\275\261\350\247\206.js" @@ -0,0 +1,8 @@ +var rule = Object.assign(muban.mxpro,{ +title:'Nike影视', +host:'https://www.ajeee.com', +url:'/show/fyclass/page/fypage.html', +class_name:'电影&电视剧&综艺&动漫', +class_url:'Movie&Tv&Variety&Cartoon', +class_parse:'', +}); \ No newline at end of file diff --git "a/txt/js/tg/TV\344\272\221\346\222\255.js" "b/txt/js/tg/TV\344\272\221\346\222\255.js" new file mode 100644 index 0000000000000000000000000000000000000000..dcd5b74611ae11edd3520aca87b1184e5c3a97e2 --- /dev/null +++ "b/txt/js/tg/TV\344\272\221\346\222\255.js" @@ -0,0 +1,9 @@ +muban.首图.二级.tabs = '.myui-panel__head.bottom-line h3'; +var rule = Object.assign(muban.首图,{ +title:'TV云播', +host:'http://www.tvyb03.com', +url:'/vod/type/id/fyclass/page/fypage.html', +class_parse:'.item.nav-list.clearfix li:gt(0):lt(5);a&&Text;a&&href;/(\\d+).html', +推荐:'.myui-panel_bd.clearfix;.myui-vodlist.clearfix&&li;a&&title;a&&data-original;.background-color&&Text;a&&href', + 一级:'.myui-vodlist li;a&&title;a&&data-original;.pic-tag-top&&Text;a&&href', +}); \ No newline at end of file diff --git "a/txt/js/tg/\344\270\244\344\270\252BT.js" "b/txt/js/tg/\344\270\244\344\270\252BT.js" new file mode 100644 index 0000000000000000000000000000000000000000..0c1d98bb437c2f072e6ae4a9027209f7ebddc8b5 --- /dev/null +++ "b/txt/js/tg/\344\270\244\344\270\252BT.js" @@ -0,0 +1,26 @@ +var rule = { + title:'两个BT', + host:'https://www.bttwoo.com', + // homeUrl:'/', + url:'/fyclass/page/fypage', + searchUrl:'/xssearch?q=**', + searchable:0, + quickSearch:0, + headers:{ + 'User-Agent':'UC_UA' + }, + timeout:5000, + class_name:'最新电影&国产剧&美剧&日韩剧',//静态分类名称拼接 + class_url:'new-movie&zgjun&meiju&jpsrtv',//静态分类标识拼接 + class_parse:'', + play_parse:true, + lazy:'', + limit:5, + 推荐:'.leibox;li;.lazy&&alt;.thumb.lazy&&data-original;.jidi span&&Text;a&&href', + double:true, // 推荐内容是否双层定位 + 一级:'.bt_img li;.lazy&&alt;.thumb.lazy&&data-original;.jidi span&&Text;a&&href', + + 二级:{"title":".moviedteail_tt h1&&Text","img":".dyimg.fl img&&src","desc":".cr3.starLink&&Text","content":".yp_context&&Text","tabs":".ypxingq_t:eq(1) span","lists":".paly_list_btn:eq(#id) a"}, + 搜索:'*', + +} diff --git "a/txt/js/tg/\344\271\220\347\214\252TV.js" "b/txt/js/tg/\344\271\220\347\214\252TV.js" new file mode 100644 index 0000000000000000000000000000000000000000..3b1b978887c9e8fb508db1f3167a2d04504fca6d --- /dev/null +++ "b/txt/js/tg/\344\271\220\347\214\252TV.js" @@ -0,0 +1,23 @@ +var rule = { + title:'乐猪TV', + host:'http://www.lezhutv.com', + // homeUrl:'/', + url:'/type/fyclass-fypage.html', + searchUrl:'/s/**/fypage.html', + searchable:0, + quickSearch:0, + headers:{ + 'User-Agent':'UC_UA' + }, + timeout:5000, + class_parse:'div.nav a;a&&Text;a&&href;/(\\d.+).html', + play_parse:true, + lazy:'', + limit:5, + 推荐:'.movie-list-body;.movie-list-item;.movie-title&&Text;.movie-post-lazyload&&data-original;.movie-rating&&Text;a&&href', + double:true, // 推荐内容是否双层定位 + 一级:'ul.tbox_m2 li;a&&title;a&&data-original;span&&Text;a&&href', + 二级:{"title":".data h4&&Text","img":".item-lazy&&data-original","desc":".cr3.starLink&&Text","content":".tbox_js&&Text","tabs":".tbox_t&&h3","lists":".list_block.show:eq(#id) li"}, + 搜索:'.vod-search-list;.movie-title&&Text;.Lazy&&data-original;.getop&&Text;a&&href;.getop:eq(-1)&&Text', + +} diff --git "a/txt/js/tg/\345\211\247\350\215\222.js" "b/txt/js/tg/\345\211\247\350\215\222.js" new file mode 100644 index 0000000000000000000000000000000000000000..7272b82617711b92fe2bd78b5a52a062bec5bf18 --- /dev/null +++ "b/txt/js/tg/\345\211\247\350\215\222.js" @@ -0,0 +1,27 @@ +var rule = { + title:'剧荒', + host:'https://www.juhuang.tv', + // homeUrl:'/', + url:'/type/fyclass_type_fypage.html', + searchUrl:'/s/**/fypage.html', + searchable:1, + quickSearch:1, + headers:{ + 'User-Agent':'UC_UA' + }, + timeout:5000, + class_name:'电视剧&电影&综艺&动漫',//静态分类名称拼接 + class_url:'2&1&3&4',//静态分类标识拼接 + //class_parse:'.drop-content-items li:gt(0):lt(7);.grid-item-name&&Text;a&&href', + play_parse:true, + lazy:'', + limit:5, + 推荐:'#movie-list-body;.movie-list-item;a&&title;.lazyloaded&&data-src;.module-item-text&&Text;a&&href', + double:true, // 推荐内容是否双层定位 + + 一级:'.module-item-pic&&a;a&&title;img&&data-src;.module-item-text&&Text;a&&href', + + + 二级:{"title":"h1.movie-title&&Text;.data:eq(1)&&Text","img":".poster img&&src","desc":".cr3.starLink&&Text","content":".detailsTxt&&Text","tabs":".play_source_tab a","lists":".content_playlist:eq(#id) a"}, + 搜索:'.vod-search-list;.movie-title&&Text;.Lazy&&data-original;.getop&&Text;a&&href;.getop:eq(-1)&&Text', +} \ No newline at end of file diff --git "a/txt/js/tg/\345\211\247\350\277\267.js" "b/txt/js/tg/\345\211\247\350\277\267.js" new file mode 100644 index 0000000000000000000000000000000000000000..e9e219b9d4b1ecb8d12db75b5957cf2f68648bcf --- /dev/null +++ "b/txt/js/tg/\345\211\247\350\277\267.js" @@ -0,0 +1,11 @@ +muban.首图.二级.tabs = '.myui-panel__head.bottom-line h3'; +var rule = Object.assign(muban.首图,{ +title:'剧迷', +host:'https://gmtv1.xyz', +url:'/genre/fyclass---fypage.html', +searchUrl:'/search/-------------.html?wd=*&submit=', +class_name:'电视剧&电影&综艺&动漫',//静态分类名称拼接 +class_url:'2&1&3&4',//静态分类标识拼接 +class_parse:'', +一级:'.myui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href', +}); diff --git "a/txt/js/tg/\345\244\247\345\270\210\345\205\204\345\275\261\350\247\206.js" "b/txt/js/tg/\345\244\247\345\270\210\345\205\204\345\275\261\350\247\206.js" new file mode 100644 index 0000000000000000000000000000000000000000..b35a7c4fb17399ac680d2a22aad7b8a1f105c76b --- /dev/null +++ "b/txt/js/tg/\345\244\247\345\270\210\345\205\204\345\275\261\350\247\206.js" @@ -0,0 +1,7 @@ +var rule = Object.assign(muban.mxpro,{ +title:'大师兄影视.', +host:'https://dsxys.com', +url:'/vodshow/fyclass--------fypage---.html', +searchUrl:'/search-**----------fypage---/', +class_parse:'.navbar-items.swiper-wrapper li;a&&title;a&&href;/(\\d+).html', +}); diff --git "a/txt/js/tg/\345\244\251\347\251\272\345\275\261\350\247\206.js" "b/txt/js/tg/\345\244\251\347\251\272\345\275\261\350\247\206.js" new file mode 100644 index 0000000000000000000000000000000000000000..e000e8eed6c41f2681049836c7a5b42453e5fe67 --- /dev/null +++ "b/txt/js/tg/\345\244\251\347\251\272\345\275\261\350\247\206.js" @@ -0,0 +1,9 @@ +var rule = Object.assign(muban.首图,{ +title:'天空影视', +host:'https://www.tkys6.com', +url:'/vodshow/id/fyclass/page/fypage.html', +searchUrl:'/search/-------------.html?wd=*&submit=', +//class_name:'电视剧&电影&综艺&动漫&blbl',//静态分类名称拼接 +//class_url:'2&1&3&4&29',//静态分类标识拼接 +class_parse:'.myui-header__menu li.hidden-sm:gt(0):lt(8);a&&Text;a&&href;/(\\d+).html', +}); diff --git "a/txt/js/tg/\345\256\214\347\276\216\347\234\213\347\234\213.js" "b/txt/js/tg/\345\256\214\347\276\216\347\234\213\347\234\213.js" new file mode 100644 index 0000000000000000000000000000000000000000..c8211ceb5751edb102956bd25eed9dc1de5ab532 --- /dev/null +++ "b/txt/js/tg/\345\256\214\347\276\216\347\234\213\347\234\213.js" @@ -0,0 +1,10 @@ +muban.首图2.二级.tabs = '.stui-pannel__head&&h3'; +var rule = Object.assign(muban.首图2,{ +title:'完美看看', +host:'https://www.wanmeikk.film', +url:'/category/fyclass-fypage.html', +searchUrl:'/vodsearch/**-------------.html', +class_name:'电影&美剧&韩剧&日剧&国产剧&动漫',//静态分类名称拼接 +class_url:'1&2&3&4&5&6',//静态分类标识拼接 +class_parse:'', +}); diff --git "a/txt/js/tg/\345\277\253\344\272\221\345\275\261\351\231\242.js" "b/txt/js/tg/\345\277\253\344\272\221\345\275\261\351\231\242.js" new file mode 100644 index 0000000000000000000000000000000000000000..8f479c8a264fd351f9048bc4c57d01ee749c8940 --- /dev/null +++ "b/txt/js/tg/\345\277\253\344\272\221\345\275\261\351\231\242.js" @@ -0,0 +1,24 @@ +var rule = { + title:'快云', + host:'https://kuaiyunyy.com', + // homeUrl:'/', + url:'/index.php/vod/show/id/fyclass/page/fypage.html', + //searchUrl:'/vodsearch/**----------fypage---.html', + searchable:0,//是否启用全局搜索, + quickSearch:0,//是否启用快速搜索, + filterable:0,//是否启用分类筛选, + headers:{//网站的请求头,完整支持所有的,常带ua和cookies + 'User-Agent':'MOBILE_UA', + // "Cookie": "searchneed=ok" + }, + class_parse:'.nav-menu-items&&li;a&&title;a&&href;/(\\d+).html', + cate_exclude:'直播|足球', + play_parse:true, + lazy:'', + limit:8, + 推荐:'.module-items;.module-item-cover&&.module-item-pic;a&&title;.lazyloaded&&data-src;.item-text&&Text;a&&href', + double:true, // 推荐内容是否双层定位 + 一级:'.module-list&&.module-item-pic;a&&title;.lazyloaded&&data-src;.module-item-text&&Text;a&&href', + 二级:{"title":"h1.page-title&&Text;.video-info-aux&&Text","img":".lazyload&&data-src","content":".content.vod_content&&Text","tabs":".module-tab-item.tab-item","lists":".module-blocklist.scroll-box:eq(#id) a"}, + +} diff --git "a/txt/js/tg/\347\210\261\347\234\213\345\275\261\350\247\206.js" "b/txt/js/tg/\347\210\261\347\234\213\345\275\261\350\247\206.js" new file mode 100644 index 0000000000000000000000000000000000000000..c6427d1d4fbbd9811a7b1707c0a914e0e8fc69c2 --- /dev/null +++ "b/txt/js/tg/\347\210\261\347\234\213\345\275\261\350\247\206.js" @@ -0,0 +1,9 @@ +var rule = Object.assign(muban.mxpro,{ + title:'爱看影视', + host:'https://ikan6.vip', + url:'/vodshow/fyclass--------fypage---/', + searchUrl:'/vodsearch/**----------fypage---/', + class_name:'电影&电视剧&综艺&动漫&日韩剧&美剧&港台剧', + class_url:'1&2&3&4&15&16&14', + class_parse:'', +}); \ No newline at end of file diff --git "a/txt/js/tg/\347\210\261\347\234\213\347\224\265\345\275\261.js" "b/txt/js/tg/\347\210\261\347\234\213\347\224\265\345\275\261.js" new file mode 100644 index 0000000000000000000000000000000000000000..ea3edc602b99837b02e00e1d6b6bab3e9d0d5584 --- /dev/null +++ "b/txt/js/tg/\347\210\261\347\234\213\347\224\265\345\275\261.js" @@ -0,0 +1,23 @@ +var rule = { + title:'爱看', + host:'https://ikandy.fun', + // homeUrl:'/', + url:'/vodtype/fyclass-fypage/', + //searchUrl:'/vodsearch/**----------fypage---.html', + searchable:0,//是否启用全局搜索, + quickSearch:0,//是否启用快速搜索, + filterable:0,//是否启用分类筛选, + headers:{//网站的请求头,完整支持所有的,常带ua和cookies + 'User-Agent':'MOBILE_UA', + // "Cookie": "searchneed=ok" + }, + class_parse:'.stui-header__menu li.hidden-xs;a&&Text;a&&href;/(\\d+)/', + play_parse:true, + lazy:'', + limit:8, + 推荐:'.stui-vodlist.clearfix;.stui-vodlist__box;a&&title;a&&data-original;.pic-text&&Text;a&&href', + double:true, // 推荐内容是否双层定位 + 一级:'.stui-vodlist.clearfix li;a&&title;a&&data-original;.pic-text&&Text;a&&href', + 二级:{"title":"h1.title&&Text;.stui-content__detail p:eq(0)&&Text","img":".lazyload&&src","content":".stui-content__detail p:eq(4)&&Text","tabs":".playlist.mb h3.title","lists":".stui-content__playlist:eq(#id) li"}, + +} diff --git "a/txt/js/tg/\347\211\271\347\213\227\345\275\261\350\247\206.js" "b/txt/js/tg/\347\211\271\347\213\227\345\275\261\350\247\206.js" new file mode 100644 index 0000000000000000000000000000000000000000..b9b68285e9289a39043fafa415ee53f90a37f709 --- /dev/null +++ "b/txt/js/tg/\347\211\271\347\213\227\345\275\261\350\247\206.js" @@ -0,0 +1,10 @@ +var rule = Object.assign(muban.首图,{ +title:'特狗', +host:'https://www.tegouys.com', +url:'/vodshow/id/fyclass/page/fypage.html', +searchUrl:'/search/-------------.html?wd=*&submit=', +//class_name:'电视剧&电影&综艺&动漫',//静态分类名称拼接 +//class_url:'2&1&3&4',//静态分类标识拼接 +class_parse:'.myui-header__menu li.hidden-sm:gt(0):lt(5);a&&Text;a&&href;/(\\d+).html', + +}); diff --git "a/txt/js/tg/\347\232\256\347\232\256\346\263\241.js" "b/txt/js/tg/\347\232\256\347\232\256\346\263\241.js" new file mode 100644 index 0000000000000000000000000000000000000000..359c54b4f2ec7e338398ac26aa7b90e4f5b54b00 --- /dev/null +++ "b/txt/js/tg/\347\232\256\347\232\256\346\263\241.js" @@ -0,0 +1,10 @@ +muban.首图2.二级.tabs = '.stui-pannel__head.bottom-line.active.clearfix h3'; +var rule = Object.assign(muban.首图2,{ +title:'皮皮泡', +host:'https://www.pipipao.com', +url:'/vodshow/id/fyclass/page/fypage.html', +searchUrl:'/vodsearch**/page/fypage.html', +class_name:'电视剧&电影&综艺&动漫&纪录片',//静态分类名称拼接 +class_url:'dianshiju&dianying&zongyi&dongman&jilupian',//静态分类标识拼接 +class_parse:' ', +}); \ No newline at end of file diff --git "a/txt/js/tg/\347\234\213\344\272\206\344\271\210.js" "b/txt/js/tg/\347\234\213\344\272\206\344\271\210.js" new file mode 100644 index 0000000000000000000000000000000000000000..eefa2a6b71b7bfba46603469c2b8e7b598c80b49 --- /dev/null +++ "b/txt/js/tg/\347\234\213\344\272\206\344\271\210.js" @@ -0,0 +1,26 @@ +var rule = { + title:'看了么', + host:'https://www.ksksl.com', + // homeUrl:'/', + url:'/show/fyclass/page/fypage.html', + searchUrl:'/ch.html?wd=**', + searchable:1, + quickSearch:1, + headers:{ + 'User-Agent':'UC_UA' + }, + timeout:5000, + class_name:'电影&电视剧&动漫&综艺&纪录片',//静态分类名称拼接 + class_url:'dy&tv&dm&zy&jl',//静态分类标识拼接 + play_parse:true, + lazy:'', + limit:5, + 推荐:'.dx-top;li;a&&title;a&&data-original;.vod_remarks&&Text;a&&href', + double:true, // 推荐内容是否双层定位 + + 一级:'ul.dx-list li;a&&title;a&&data-original;.vod_remarks&&Text;a&&href', + + 二级:{"title":".obj-info h1&&Text;","img":"img:eq(2)&&src","desc":".video-info.d-none.d-sm-block&&Text","content":".vod_content&&Text","tabs":".play-title h2","lists":".play_li.fn-clear:eq(#id) a"}, + + 搜索:'.movie-list-body;.movie-list-item;.movie-title&&Text;.movie-post-lazyload&&data-original;.vod_remarks&&Text;a&&href', +} \ No newline at end of file diff --git "a/txt/js/tg/\350\203\226\350\231\216\345\275\261\350\247\206.js" "b/txt/js/tg/\350\203\226\350\231\216\345\275\261\350\247\206.js" new file mode 100644 index 0000000000000000000000000000000000000000..7f65b10e70af6889d568d5d182b706c4dba90ca6 --- /dev/null +++ "b/txt/js/tg/\350\203\226\350\231\216\345\275\261\350\247\206.js" @@ -0,0 +1,7 @@ +var rule = Object.assign(muban.mxpro,{ +title:'胖虎影视.', +host:'http://panghuys.com', +url:'/vodshow/fyclass/page/fypage.html', +searchUrl:'/search-**----------fypage---/', +class_parse:'.navbar-items li:gt(1):lt(7);a&&Text;a&&href;/(\\d+).html', +}); diff --git a/utils/files.py b/utils/files.py index fbabaeabf80bebca6e79e5671afb8ea94894ddab..40bc8a4a7cccadad85e6b7144bdabe7938836bfe 100644 --- a/utils/files.py +++ b/utils/files.py @@ -8,9 +8,8 @@ import os import shutil from utils.system import getHost -from utils.encode import base64Encode from controllers.service import storage_service -from utils.encode import parseText +from utils.encode import base64Encode,parseText from flask import render_template_string from utils.log import logger diff --git a/utils/parser.py b/utils/parser.py index 424d61c7bb0ddd1a45bbd8d6b3cea9874b77e921..6c58916846de71c492adc7bf65bd3f6a977bf136 100644 --- a/utils/parser.py +++ b/utils/parser.py @@ -5,6 +5,7 @@ # Date : 2022/8/25 import os +import shutil import requests from flask import make_response, jsonify @@ -41,7 +42,9 @@ def runJs(jsPath, before='', after='', ctx=None): print('远程规则:',js_name) if not os.path.exists(cache_path): try: - js_code = requests.get(jsPath,timeout=2).text + print(jsPath) + js_code = requests.get(url=jsPath,timeout=3).text + # js_code = requests.get(jsPath).text with open(cache_path,mode='w+',encoding='utf-8') as f: f.write(js_code) except Exception as e: @@ -52,7 +55,13 @@ def runJs(jsPath, before='', after='', ctx=None): js_code = fp.read() else: js_path = os.path.join(base_path, jsPath) - # print(js_path) + if not os.path.exists(js_path): + return None,'' + js_name = jsPath.split('/')[-1] + cache_path = os.path.join(base_path, f'cache/{js_name}') + if not os.path.exists(cache_path) and os.path.exists(js_path): + shutil.copy(js_path,cache_path) + print(js_path) with open(js_path, 'r', encoding='UTF-8') as fp: js_code = fp.read() # print(js_code) diff --git a/utils/ua.py b/utils/ua.py new file mode 100644 index 0000000000000000000000000000000000000000..18a96515507f7da86ff1d83a6a2899b13fc5126e --- /dev/null +++ b/utils/ua.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# File : ua.py +# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ +# Date : 2022/9/19 +from time import time + +MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36' +PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36' +UA = 'Mozilla/5.0' +UC_UA = 'Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36' +IOS_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' +headers = { + 'Referer': 'https://www.baidu.com', + 'user-agent': UA, +} + +def get_interval(t): + interval = time() - t + interval = round(interval*1000,2) + return interval + +def getHeaders(url): + headers = {} + if url: + headers["Referer"] = url + headers["User-Agent"] = UA + # headers.setdefault("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") + # headers.setdefault("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2") + return headers \ No newline at end of file diff --git a/utils/web.py b/utils/web.py index 22d4ebc67be117359d563ace246784c7aa3f9bfd..2dbf275ea6fc184ec65553e69a41b915247233b4 100644 --- a/utils/web.py +++ b/utils/web.py @@ -7,19 +7,9 @@ import os from flask import request,jsonify import hashlib -from time import time # from utils.cfg import cfg from controllers.service import storage_service - -MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36' -PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36' -UA = 'Mozilla/5.0' -UC_UA = 'Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36' -IOS_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' -headers = { - 'Referer': 'https://www.baidu.com', - 'user-agent': UA, -} +from utils.ua import * def getParmas(key=None,value=''): """ @@ -73,18 +63,4 @@ def verfy_token(token=None): # print(f'username:{username},pwd:{pwd},current_token:{ctoken},input_token:{ctoken}') if token != ctoken: return False - return True - -def get_interval(t): - interval = time() - t - interval = round(interval*1000,2) - return interval - -def getHeaders(url): - headers = {} - if url: - headers["Referer"] = url - headers["User-Agent"] = UA - # headers.setdefault("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") - # headers.setdefault("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2") - return headers \ No newline at end of file + return True \ No newline at end of file