update
This commit is contained in:
@ -44,24 +44,27 @@ class BaiduRecordCommand extends BaseSpider
|
||||
public function configure()
|
||||
{
|
||||
parent::configure();
|
||||
$this->setDescription('36kr.com');
|
||||
$this->setDescription('查百度收录');
|
||||
$this->addOption('id', 'i', InputOption::VALUE_OPTIONAL, '指定的新闻id.', false);
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
|
||||
// 新闻:/touch/reconstruct/article/list/BBM54PGAwangning/0-10.html
|
||||
|
||||
$this->_start();
|
||||
$id = $input->getOption('id');
|
||||
$this->_start($id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 采集新闻板块
|
||||
private function _start()
|
||||
private function _start(int|bool $id = false)
|
||||
{
|
||||
$cache = [];
|
||||
$requestCookie = '';
|
||||
AppNews::query()->where('is_delete', 0)->each(function($item) use (&$requestCookie, &$cache) {
|
||||
$query = AppNews::query()->where('is_delete', 0)->where('is_record', 0);
|
||||
if ($id) {
|
||||
$query->where('id', $id);
|
||||
}
|
||||
$query->each(function($item) use (&$requestCookie, &$cache) {
|
||||
try {
|
||||
if (!$item->platform) {
|
||||
throw new \Exception('没找到平台!!');
|
||||
@ -98,6 +101,7 @@ class BaiduRecordCommand extends BaseSpider
|
||||
if (stripos($res, '验证') !== false) {
|
||||
$this->log->info('有验证码!!');
|
||||
}
|
||||
var_dump($res)
|
||||
(new Crawler($res))->filter('.abs')->each(function ($node) use ($domain, $item) {
|
||||
if (stripos($node->html(), $domain) !== false) {
|
||||
$this->log->info('已收录');
|
||||
|
Reference in New Issue
Block a user