From 1664db7a3a0904ff3f3304111fb98d6b55385da1 Mon Sep 17 00:00:00 2001 From: make Date: Thu, 19 Jun 2025 13:13:36 +0800 Subject: [PATCH] debug-novel-task --- code/app/task/crawler/zw/page/ChapterPage.php | 6 +++--- code/app/task/crawler/zw/page/Site.php | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/code/app/task/crawler/zw/page/ChapterPage.php b/code/app/task/crawler/zw/page/ChapterPage.php index 3c26414..9cb1c7b 100644 --- a/code/app/task/crawler/zw/page/ChapterPage.php +++ b/code/app/task/crawler/zw/page/ChapterPage.php @@ -96,10 +96,10 @@ class ChapterPage extends BasePage } else { $this->arrChapterInfo['c_page_data'] = NULL; - if(config('log.task_debug_log_open_status')){ + $incKey = config('task.app_name').'_getChapterInfo_lastread_null:' . date('Y-m-d'); + $this->redisDailyInc($incKey); - $incKey = config('task.app_name').'_getChapterInfo_lastread_null:' . date('Y-m-d'); - $this->redisDailyInc($incKey); + if(config('log.task_debug_log_open_status')){ // 记录失败原因 \think\facade\Log::error("Request getChapterInfo_lastread == NULL , c_page_data == NULL, "); diff --git a/code/app/task/crawler/zw/page/Site.php b/code/app/task/crawler/zw/page/Site.php index 167ce93..0706b12 100644 --- a/code/app/task/crawler/zw/page/Site.php +++ b/code/app/task/crawler/zw/page/Site.php @@ -296,6 +296,13 @@ class Site continue; } + // 如果不匹配有这个 说明没有请求到小说章节 或者 章节为空 + $strPattern = "/lastread\.set\((.*?)\);/"; + if (!preg_match($strPattern, $strContent, $arrMatches)) { + var_dump(mb_substr($strContent, 0, 300)); // 防止输出太长 + continue; + } + $ChapterPage = $this->getChapterPage($this, $arrFilter[$intKey]['uri']); $ChapterPage->setContent($strContent); $ChapterPage->setData($arrFilter[$intKey]);