提交 be1f7c38 编写于 作者: H hjdhnx

增加了20多个缓存源,未内置

上级 2f9089df
......@@ -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},
......
无法预览此类型文件
......@@ -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(): # 管理员界面
......
......@@ -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')
......
......@@ -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)}毫秒')
......
......@@ -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
3.6.13
\ No newline at end of file
3.6.14
\ No newline at end of file
......@@ -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的源忽略参与聚搜,正常单一搜索
......
......@@ -217,7 +217,7 @@ function getFileSize(fileObj) {
<input type="button" id="upload" value="上传" class="btn"/>
</form>
<p id="file_size"></p>
<h2>规则列表数据-共{{rules.count}}条</h2>
<h4 >规则列表数据-共{{rules.count+cache_count}}条(内置:{{rules.count}} 缓存:{{cache_count}})</h4>
{% if rules.count < 1 %}
<h3>暂无内置的规则</h3>
{% endif %}
......
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',
二级:'*',
}
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,//是否启用分类筛选,
}
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',
二级:'*',
}
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',
二级:'*',
}
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/(.*?)/',
});
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
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
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
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"},
搜索:'*',
}
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',
}
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
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',
});
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',
});
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',
});
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:'',
});
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"},
}
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
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"},
}
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',
});
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
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
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',
});
......@@ -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
......
......@@ -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)
......
#!/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
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册