Automation/app/Libraries/MyCrawlerLibrary.php
2024-09-15 16:02:23 +09:00

32 lines
829 B
PHP

<?php
namespace App\Libraries;
use App\Libraries\CommonLibrary;
use Symfony\Component\DomCrawler\Crawler;
abstract class MyCrawlerLibrary extends CommonLibrary
{
protected function __construct()
{
parent::__construct();
}
abstract public function getMySocket();
abstract public function getMyStorage();
abstract public function execute(): void;
final protected function getSelector(string $content, string $tag): Crawler
{
$crawler = new Crawler($content);
if ($this->getDebug()) {
log_message("debug", sprintf(
"\n---------%s----------\ntag:%s\n%s\n-------------------\n",
__FUNCTION__,
$tag,
$content
));
exit;
}
return $crawler->filter($tag);
}
}