From 02294b9ea45be8bee679053efa4c8e5ce38884c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Tue, 4 Aug 2026 01:29:21 +0800 Subject: [PATCH] =?UTF-8?q?style(kuaishou):=20=E4=BC=98=E5=8C=96=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E4=B8=BA=E6=9D=A1?= =?UTF-8?q?=E7=9B=AE=E6=91=98=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 视频详情不再打印完整 JSON,改为单行摘要(id/作者/点赞/播放/标题) - 搜索每页输出搜索到的视频条数 - 创作者输出获取到的视频总数 --- media_platform/kuaishou/core.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/media_platform/kuaishou/core.py b/media_platform/kuaishou/core.py index 7675286..58f1b4f 100644 --- a/media_platform/kuaishou/core.py +++ b/media_platform/kuaishou/core.py @@ -178,6 +178,10 @@ class KuaishouCrawler(AbstractCrawler): video_id_list.append(video_detail.get("photo", {}).get("id")) await kuaishou_store.update_kuaishou_video(video_item=video_detail) + utils.logger.info( + f"[KuaishouCrawler.search] keyword: {keyword}, page: {page}, got {len(video_id_list)} videos" + ) + # batch fetch video comments page += 1 @@ -223,10 +227,17 @@ class KuaishouCrawler(AbstractCrawler): await asyncio.sleep(config.CRAWLER_MAX_SLEEP_SEC) utils.logger.info(f"[KuaishouCrawler.get_video_info_task] Sleeping for {config.CRAWLER_MAX_SLEEP_SEC} seconds after fetching video details {video_id}") - utils.logger.info( - f"[KuaishouCrawler.get_video_info_task] Get video_id:{video_id} info result: {result} ..." - ) - return result.get("visionVideoDetail") + detail = result.get("visionVideoDetail") + if detail: + photo = detail.get("photo", {}) + author = detail.get("author", {}) + utils.logger.info( + f"[KuaishouCrawler.get_video_info_task] video detail: " + f"id={photo.get('id', video_id)} author={author.get('name', '')} " + f"likes={photo.get('likeCount', '')} views={photo.get('viewCount', '')} " + f"caption={str(photo.get('caption', ''))[:50]}" + ) + return detail except DataFetchError as ex: utils.logger.error( f"[KuaishouCrawler.get_video_info_task] Get video detail error: {ex}" @@ -424,6 +435,9 @@ class KuaishouCrawler(AbstractCrawler): crawl_interval=config.CRAWLER_MAX_SLEEP_SEC, callback=self.fetch_creator_video_detail, ) + utils.logger.info( + f"[KuaishouCrawler.get_creators_and_videos] creator: {user_id}, got {len(all_video_list)} videos" + ) video_ids = [ video_item.get("photo", {}).get("id") for video_item in all_video_list