mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-06-06 09:57:25 +08:00
fix: 修复B站搜索Field命名 bug
refactor: ping接口统一更换为pong
This commit is contained in:
@@ -54,6 +54,8 @@ class BilibiliClient:
|
||||
:param req_data:
|
||||
:return:
|
||||
"""
|
||||
if not req_data:
|
||||
return {}
|
||||
img_key, sub_key = await self.get_wbi_keys()
|
||||
return BilibiliSign(img_key, sub_key).sign(req_data)
|
||||
|
||||
@@ -91,10 +93,14 @@ class BilibiliClient:
|
||||
|
||||
async def pong(self) -> bool:
|
||||
"""get a note to check if login state is ok"""
|
||||
utils.logger.info("Begin pong kuaishou...")
|
||||
utils.logger.info("Begin pong bilibili...")
|
||||
ping_flag = False
|
||||
try:
|
||||
pass
|
||||
check_login_uri = "/x/web-interface/nav"
|
||||
response = await self.get(check_login_uri)
|
||||
if response.get("isLogin"):
|
||||
utils.logger.info("use cache login state get web interface successfull!")
|
||||
ping_flag = True
|
||||
except Exception as e:
|
||||
utils.logger.error(f"Pong kuaishou failed: {e}, and try to login again...")
|
||||
ping_flag = False
|
||||
|
||||
@@ -22,7 +22,7 @@ from var import comment_tasks_var, crawler_type_var
|
||||
|
||||
|
||||
from .client import BilibiliClient
|
||||
from .field import OrderType
|
||||
from .field import SearchOrderType
|
||||
from .login import BilibiliLogin
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class BilibiliCrawler(AbstractCrawler):
|
||||
keyword=keyword,
|
||||
page=page,
|
||||
page_size=bili_limit_count,
|
||||
order=OrderType.DEFAULT,
|
||||
order=SearchOrderType.DEFAULT,
|
||||
)
|
||||
video_list: List[Dict] = videos_res.get("result")
|
||||
for video_item in video_list:
|
||||
|
||||
Reference in New Issue
Block a user