更改py标准

This commit is contained in:
晚风拂柳颜 2024-01-10 03:07:35 +08:00
parent be2e043584
commit f045dbe823
4 changed files with 54 additions and 24 deletions

View File

@ -91,19 +91,28 @@ class Spider(BaseSpider): # 元类 默认的元类 type
except Exception as e:
print(f'更新扩展筛选条件发生错误:{e}')
ext = self.extend
print(f"============{extend}============")
if extend.startswith('./'):
ext_file = os.path.join(os.path.dirname(__file__), extend)
init_file(ext_file)
elif extend.startswith('http'):
try:
r = self.fetch(extend)
self.config['filter'].update(r.json())
except Exception as 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)
if isinstance(ext, str) and ext:
if ext.startswith('./'):
ext_file = os.path.join(os.path.dirname(__file__), ext)
init_file(ext_file)
elif ext.startswith('http'):
try:
r = self.fetch(ext)
self.config['filter'].update(r.json())
except Exception as e:
print(f'更新扩展筛选条件发生错误:{e}')
elif not ext.startswith('./') and not ext.startswith('http'):
ext_file = os.path.join(os.path.dirname(__file__), './' + ext + '.json')
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):
pass

File diff suppressed because one or more lines are too long

View File

@ -145,21 +145,24 @@ class Spider(BaseSpider): # 元类 默认的元类 type
except Exception as e:
print(f'更新扩展筛选条件发生错误:{e}')
ext = self.extend
print(f"============{extend}============")
if isinstance(extend, str):
if extend.startswith('./'):
ext_file = os.path.join(os.path.dirname(__file__), extend)
if isinstance(ext, str):
if ext.startswith('./'):
ext_file = os.path.join(os.path.dirname(__file__), ext)
init_file(ext_file)
elif extend.startswith('http'):
elif ext.startswith('http'):
try:
r = self.fetch(extend)
r = self.fetch(ext)
self.config['filter'].update(r.json())
except Exception as 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')
elif not ext.startswith('./') and not ext.startswith('http'):
ext_file = os.path.join(os.path.dirname(__file__), './' + ext + '.json')
init_file(ext_file)
elif isinstance(extend, list):
# 装载模块,这里只要一个就够了
if isinstance(extend, list):
for lib in extend:
if '.Spider' in str(type(lib)):
self.module = lib

View File

@ -29,7 +29,17 @@ api里会自动含有ext参数是base64编码后的选中的筛选条件
"quickSearch":1,
"filterable":1,
"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:
@return:
"""
if extend.startswith('http'):
self.init_extend(extend)
ext = self.extend
if ext.startswith('http'):
self.init_extend(ext)
else:
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):
pass