更改py标准
This commit is contained in:
parent
be2e043584
commit
f045dbe823
@ -91,20 +91,29 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'更新扩展筛选条件发生错误:{e}')
|
print(f'更新扩展筛选条件发生错误:{e}')
|
||||||
|
|
||||||
|
ext = self.extend
|
||||||
print(f"============{extend}============")
|
print(f"============{extend}============")
|
||||||
if extend.startswith('./'):
|
if isinstance(ext, str) and ext:
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), extend)
|
if ext.startswith('./'):
|
||||||
|
ext_file = os.path.join(os.path.dirname(__file__), ext)
|
||||||
init_file(ext_file)
|
init_file(ext_file)
|
||||||
elif extend.startswith('http'):
|
elif ext.startswith('http'):
|
||||||
try:
|
try:
|
||||||
r = self.fetch(extend)
|
r = self.fetch(ext)
|
||||||
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'):
|
elif not ext.startswith('./') and not ext.startswith('http'):
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), './' + extend + '.json')
|
ext_file = os.path.join(os.path.dirname(__file__), './' + ext + '.json')
|
||||||
init_file(ext_file)
|
init_file(ext_file)
|
||||||
|
|
||||||
|
# 装载模块,这里只要一个就够了
|
||||||
|
if isinstance(extend, list):
|
||||||
|
for lib in extend:
|
||||||
|
if '.Spider' in str(type(lib)):
|
||||||
|
self.module = lib
|
||||||
|
break
|
||||||
|
|
||||||
def isVideoFormat(self, url):
|
def isVideoFormat(self, url):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -145,21 +145,24 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'更新扩展筛选条件发生错误:{e}')
|
print(f'更新扩展筛选条件发生错误:{e}')
|
||||||
|
|
||||||
|
ext = self.extend
|
||||||
print(f"============{extend}============")
|
print(f"============{extend}============")
|
||||||
if isinstance(extend, str):
|
if isinstance(ext, str):
|
||||||
if extend.startswith('./'):
|
if ext.startswith('./'):
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), extend)
|
ext_file = os.path.join(os.path.dirname(__file__), ext)
|
||||||
init_file(ext_file)
|
init_file(ext_file)
|
||||||
elif extend.startswith('http'):
|
elif ext.startswith('http'):
|
||||||
try:
|
try:
|
||||||
r = self.fetch(extend)
|
r = self.fetch(ext)
|
||||||
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'):
|
elif not ext.startswith('./') and not ext.startswith('http'):
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), './' + extend + '.json')
|
ext_file = os.path.join(os.path.dirname(__file__), './' + ext + '.json')
|
||||||
init_file(ext_file)
|
init_file(ext_file)
|
||||||
elif isinstance(extend, list):
|
|
||||||
|
# 装载模块,这里只要一个就够了
|
||||||
|
if isinstance(extend, list):
|
||||||
for lib in extend:
|
for lib in extend:
|
||||||
if '.Spider' in str(type(lib)):
|
if '.Spider' in str(type(lib)):
|
||||||
self.module = lib
|
self.module = lib
|
||||||
|
|||||||
@ -29,7 +29,17 @@ api里会自动含有ext参数是base64编码后的选中的筛选条件
|
|||||||
"quickSearch":1,
|
"quickSearch":1,
|
||||||
"filterable":1,
|
"filterable":1,
|
||||||
"ext":"https://jihulab.com/qiaoji/open/-/raw/main/yinghua"
|
"ext":"https://jihulab.com/qiaoji/open/-/raw/main/yinghua"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"key": "hipy_t3_樱花动漫",
|
||||||
|
"name": "樱花动漫(hipy_t3)",
|
||||||
|
"type": 3,
|
||||||
|
"api": "{{host}}/txt/hipy/樱花动漫.py",
|
||||||
|
"searchable": 1,
|
||||||
|
"quickSearch": 0,
|
||||||
|
"filterable": 1,
|
||||||
|
"ext": "https://jihulab.com/qiaoji/open/-/raw/main/yinghua"
|
||||||
|
},
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -109,11 +119,19 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
@param extend:
|
@param extend:
|
||||||
@return:
|
@return:
|
||||||
"""
|
"""
|
||||||
if extend.startswith('http'):
|
ext = self.extend
|
||||||
self.init_extend(extend)
|
if ext.startswith('http'):
|
||||||
|
self.init_extend(ext)
|
||||||
else:
|
else:
|
||||||
self.init_extend(self.api_qj)
|
self.init_extend(self.api_qj)
|
||||||
|
|
||||||
|
# 装载模块,这里只要一个就够了
|
||||||
|
if isinstance(extend, list):
|
||||||
|
for lib in extend:
|
||||||
|
if '.Spider' in str(type(lib)):
|
||||||
|
self.module = lib
|
||||||
|
break
|
||||||
|
|
||||||
def isVideoFormat(self, url):
|
def isVideoFormat(self, url):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user