增加依赖示例
This commit is contained in:
parent
154951797e
commit
335fe2c492
@ -60,6 +60,11 @@ api里会自动含有ext参数是base64编码后的选中的筛选条件
|
|||||||
|
|
||||||
|
|
||||||
class Spider(BaseSpider): # 元类 默认的元类 type
|
class Spider(BaseSpider): # 元类 默认的元类 type
|
||||||
|
module = None
|
||||||
|
|
||||||
|
def getDependence(self):
|
||||||
|
return ['base_spider']
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return "中央电视台" # 可搜索
|
return "中央电视台" # 可搜索
|
||||||
|
|
||||||
@ -211,6 +216,7 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
print(f'更新扩展筛选条件发生错误:{e}')
|
print(f'更新扩展筛选条件发生错误:{e}')
|
||||||
|
|
||||||
print("============{0}============".format(extend))
|
print("============{0}============".format(extend))
|
||||||
|
if isinstance(extend, str):
|
||||||
if extend.startswith('./'):
|
if extend.startswith('./'):
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), extend)
|
ext_file = os.path.join(os.path.dirname(__file__), extend)
|
||||||
init_file(ext_file)
|
init_file(ext_file)
|
||||||
@ -223,6 +229,11 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
elif extend and not extend.startswith('./') and not extend.startswith('http'):
|
elif extend and not extend.startswith('./') and not extend.startswith('http'):
|
||||||
ext_file = os.path.join(os.path.dirname(__file__), './' + extend + '.json')
|
ext_file = os.path.join(os.path.dirname(__file__), './' + extend + '.json')
|
||||||
init_file(ext_file)
|
init_file(ext_file)
|
||||||
|
elif 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
|
||||||
@ -254,6 +265,8 @@ class Spider(BaseSpider): # 元类 默认的元类 type
|
|||||||
result = {
|
result = {
|
||||||
'list': []
|
'list': []
|
||||||
}
|
}
|
||||||
|
if self.module:
|
||||||
|
result = self.module.homeVideoContent()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def categoryContent(self, tid, pg, filter, extend):
|
def categoryContent(self, tid, pg, filter, extend):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user