diff --git a/pixiv_spider.py b/pixiv_spider.py index e91a741..fab6568 100644 --- a/pixiv_spider.py +++ b/pixiv_spider.py @@ -106,7 +106,7 @@ class PixivSpider: subtitle=f"显示最新 {len(messages)}/{len(self.log_messages)} 条消息, 速度: {speed:.2f} t/s", border_style="green", padding=(1, 2), - expand=False + expand=True ) self.layout["main"].update(log_panel) @@ -178,25 +178,25 @@ class PixivSpider: if not downloader.download_work(work_id): self.failed_works.append(work_id) else: - completed_works += 1 # 计算实际速度(作品/秒) current_time = time.time() elapsed_time = current_time - start_time # 每秒更新一次速度 - completed_works += 1 + # 计算实际速度(作品/秒) current_time = time.time() elapsed_time = current_time - start_time - + completed_works += 1 # 每次下载图片后更新速度 if elapsed_time > 0: # 避免除以零错误 speed = completed_works / elapsed_time - self._update_log(f"当前速度: {speed:.2f} t / s", speed) + self._update_log(f"[cyan]已爬取[/cyan] {completed_works} [cyan]个页面![/cyan]") # 更新进度 self.progress.update( self.main_task_id, - completed=completed_works + completed=completed_works, + ) # 更新UI显示 self.layout["progress"].update(self.progress)