diff --git a/app/Command/spider/BaiduRecordCommand.php b/app/Command/spider/BaiduRecordCommand.php index 318a014..94915e9 100644 --- a/app/Command/spider/BaiduRecordCommand.php +++ b/app/Command/spider/BaiduRecordCommand.php @@ -96,8 +96,10 @@ class BaiduRecordCommand extends BaseSpider $requestCookie = $cookie; } - if (stripos($res, '验证') !== false || stripos($res, 'wappass') !== false) { + $isCaptcha = false; + if (stripos($res, '验证') !== false || stripos($res, 'wappass') !== false || $code != 200) { $this->log->info('有验证码!!'); + $isCaptcha = true; $times++; // 有验证码就跳出 if ($times > 1) { @@ -105,7 +107,9 @@ class BaiduRecordCommand extends BaseSpider } } - (new Crawler($res))?->filter('.abs')?->each(function ($node) use ($domain, $item) { + $isHtml = false; + (new Crawler($res))?->filter('.abs')?->each(function ($node) use ($domain, $item, &$isHtml) { + $isHtml = true; if (stripos($node->html(), $domain) !== false) { $this->log->info('已收录'); $f = AppNews::find($item->id); @@ -113,6 +117,12 @@ class BaiduRecordCommand extends BaseSpider $f->save(); } }); + + + if ($isHtml === false && $isCaptcha == false) { + $this->log->info($res); + } + $this->log->info('处理结束..'); }catch (\Throwable $exception) { $this->log->info($exception->getMessage());