fix bug
This commit is contained in:
@ -46,13 +46,13 @@ def search_by_tmdbid(mediaid: str,
|
|||||||
return [torrent.to_dict() for torrent in torrents]
|
return [torrent.to_dict() for torrent in torrents]
|
||||||
|
|
||||||
|
|
||||||
@router.get("/title/{keyword}", summary="模糊搜索资源", response_model=List[schemas.Context])
|
@router.get("/title", summary="模糊搜索资源", response_model=List[schemas.TorrentInfo])
|
||||||
async def search_by_title(keyword: str,
|
async def search_by_title(keyword: str = None,
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
site: int = None,
|
site: int = None,
|
||||||
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||||
"""
|
"""
|
||||||
根据名称模糊搜索站点资源
|
根据名称模糊搜索站点资源,支持分页,关键词为空是返回首页资源
|
||||||
"""
|
"""
|
||||||
torrents = SearchChain().search_by_title(title=keyword, page=page, site=site)
|
torrents = SearchChain().search_by_title(title=keyword, page=page, site=site)
|
||||||
return [Context(torrent_info=torrent).to_dict() for torrent in torrents]
|
return [torrent.to_dict() for torrent in torrents]
|
||||||
|
@ -53,7 +53,10 @@ class SearchChain(ChainBase):
|
|||||||
:param page: 页码
|
:param page: 页码
|
||||||
:param site: 站点ID
|
:param site: 站点ID
|
||||||
"""
|
"""
|
||||||
logger.info(f'开始搜索资源,关键词:{title} ...')
|
if title:
|
||||||
|
logger.info(f'开始搜索资源,关键词:{title} ...')
|
||||||
|
else:
|
||||||
|
logger.info(f'开始浏览资源,站点:{site} ...')
|
||||||
# 搜索
|
# 搜索
|
||||||
return self.__search_all_sites(keyword=title, sites=[site] if site else None, page=page) or []
|
return self.__search_all_sites(keyword=title, sites=[site] if site else None, page=page) or []
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class TNodeSpider:
|
|||||||
results = res.json().get('data', {}).get("torrents") or []
|
results = res.json().get('data', {}).get("torrents") or []
|
||||||
for result in results:
|
for result in results:
|
||||||
torrent = {
|
torrent = {
|
||||||
'id': self._indexerid,
|
'site': self._indexerid,
|
||||||
'title': result.get('title'),
|
'title': result.get('title'),
|
||||||
'description': result.get('subtitle'),
|
'description': result.get('subtitle'),
|
||||||
'enclosure': self._downloadurl % (self._domain, result.get('id')),
|
'enclosure': self._downloadurl % (self._domain, result.get('id')),
|
||||||
|
Reference in New Issue
Block a user