cctv兼容
This commit is contained in:
parent
df0eca598d
commit
eea8955197
@ -27,7 +27,7 @@
|
|||||||
"searchable":1,
|
"searchable":1,
|
||||||
"quickSearch":1,
|
"quickSearch":1,
|
||||||
"filterable":1,
|
"filterable":1,
|
||||||
"ext":"./cctv_spider.json",
|
"ext":"cctv_spider",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "t3_hipy_cctv",
|
"key": "t3_hipy_cctv",
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
3.9.49beta14
|
3.9.49beta15
|
||||||
@ -20,19 +20,10 @@ import time
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
配置示例:
|
配置示例:
|
||||||
t4不支持ext,api里会自动含有ext参数是base64编码后的选中的筛选条件
|
t4的配置里ext节点会自动变成api对应query参数extend,但t4的ext字符串不支持路径格式,比如./开头或者.json结尾
|
||||||
|
api里会自动含有ext参数是base64编码后的选中的筛选条件
|
||||||
{
|
|
||||||
"key":"hipy_cctv",
|
|
||||||
"name":"hipy_cctv",
|
|
||||||
"type":4,
|
|
||||||
"api":"http://192.168.31.49:5707/api/v1/vod/cctv_spider?api_ext=./cctv_spider.json",
|
|
||||||
"searchable":1,
|
|
||||||
"quickSearch":1,
|
|
||||||
"filterable":1,
|
|
||||||
"ext":"./cctv_spider.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
错误示例,ext含有json:
|
||||||
{
|
{
|
||||||
"key":"hipy_cctv",
|
"key":"hipy_cctv",
|
||||||
"name":"hipy_cctv",
|
"name":"hipy_cctv",
|
||||||
@ -41,6 +32,18 @@ t4不支持ext,api里会自动含有ext参数是base64编码后的选中的筛
|
|||||||
"searchable":1,
|
"searchable":1,
|
||||||
"quickSearch":1,
|
"quickSearch":1,
|
||||||
"filterable":1,
|
"filterable":1,
|
||||||
|
"ext":"cctv_spider.json"
|
||||||
|
}
|
||||||
|
正确示例。同时存在ext和api_ext会优先取ext作为extend加载init
|
||||||
|
{
|
||||||
|
"key":"hipy_cctv",
|
||||||
|
"name":"hipy_cctv",
|
||||||
|
"type":4,
|
||||||
|
"api":"http://192.168.31.49:5707/api/v1/vod/cctv_spider?api_ext={{host}}/txt/hipy/cctv_spider.json",
|
||||||
|
"searchable":1,
|
||||||
|
"quickSearch":1,
|
||||||
|
"filterable":1,
|
||||||
|
"ext":"cctv_spider"
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -194,9 +197,7 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
f.write(json.dumps(ext_file_dict, ensure_ascii=False))
|
f.write(json.dumps(ext_file_dict, ensure_ascii=False))
|
||||||
|
|
||||||
def init(self, extend=""):
|
def init(self, extend=""):
|
||||||
print("============{0}============".format(extend))
|
def init_file(ext_file):
|
||||||
if extend.startswith('./'):
|
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), extend)
|
|
||||||
ext_file = Path(ext_file).as_posix()
|
ext_file = Path(ext_file).as_posix()
|
||||||
# print(f'ext_file:{ext_file}')
|
# print(f'ext_file:{ext_file}')
|
||||||
if os.path.exists(ext_file):
|
if os.path.exists(ext_file):
|
||||||
@ -208,12 +209,20 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
self.config['filter'].update(ext_dict)
|
self.config['filter'].update(ext_dict)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'更新扩展筛选条件发生错误:{e}')
|
print(f'更新扩展筛选条件发生错误:{e}')
|
||||||
|
|
||||||
|
print("============{0}============".format(extend))
|
||||||
|
if extend.startswith('./'):
|
||||||
|
ext_file = os.path.join(os.path.dirname(__file__), extend)
|
||||||
|
init_file(ext_file)
|
||||||
elif extend.startswith('http'):
|
elif extend.startswith('http'):
|
||||||
try:
|
try:
|
||||||
r = self.fetch(extend)
|
r = self.fetch(extend)
|
||||||
self.config['filter'].update(r.json())
|
self.config['filter'].update(r.json())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'更新扩展筛选条件发生错误:{e}')
|
print(f'更新扩展筛选条件发生错误:{e}')
|
||||||
|
elif extend and not extend.startswith('./') and not extend.startswith('http'):
|
||||||
|
ext_file = os.path.join(os.path.dirname(__file__), './' + extend + '.json')
|
||||||
|
init_file(ext_file)
|
||||||
|
|
||||||
def isVideoFormat(self, url):
|
def isVideoFormat(self, url):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user