File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ async def get_video_page_info(video_id: str) -> Optional[dict]:
7171
7272@rate_limit ()
7373async def get_season_info (mid : str , season_id : str ) -> Optional [List [dict ]]:
74- """获取视频合集基本信息
74+ """获取视频合集信息
7575
7676 Args:
7777 mid (str): 合集mid
@@ -273,8 +273,8 @@ async def download_video_pic(video_pic_download_url: str) -> bytes:
273273
274274
275275@rate_limit ()
276- async def get_video_fav_id (media_id : str ) -> dict :
277- """获取收藏夹视频列表
276+ async def get_fav_info (media_id : str ) -> dict :
277+ """获取收藏夹信息
278278
279279 Args:
280280 media_id (str): 收藏夹id
@@ -284,7 +284,7 @@ async def get_video_fav_id(media_id: str) -> dict:
284284 """
285285 has_more = True
286286 page_num = 1
287- result = []
287+ result = None
288288
289289 async with httpx .AsyncClient () as client :
290290 while True :
@@ -312,10 +312,12 @@ async def get_video_fav_id(media_id: str) -> dict:
312312 if response .get ("code" ) != 0 :
313313 return None
314314
315- response = response ["data" ]
316- result += response ["medias" ]
315+ if result is None :
316+ result = response ["data" ]
317+ else :
318+ result ["medias" ] += response ["data" ]["medias" ]
317319
318- has_more = response ["has_more" ]
320+ has_more = response ["data" ][ " has_more" ]
319321
320322 if not has_more :
321323 break
Original file line number Diff line number Diff line change @@ -178,14 +178,17 @@ async def add_fav(
178178
179179 media_id = search_result [0 ]
180180
181- video_list_info = await bilibili .get_video_fav_id (media_id = media_id )
181+ fav_info = await bilibili .get_fav_info (media_id = media_id )
182+ video_list_info = fav_info ["medias" ]
183+ fav_name = fav_info ["info" ]["title" ]
182184
183185 video_list = [
184186 Video (
185187 bvid = video .get ("bvid" ),
186188 pic = video .get ("cover" ),
187189 title = video .get ("title" ),
188190 aid = video .get ("id" ),
191+ belong = fav_name ,
189192 )
190193 for video in video_list_info
191194 ]
You can’t perform that action at this time.
0 commit comments