Automation init...3

This commit is contained in:
최준흠 2024-09-18 20:20:58 +09:00
parent 698c041a4c
commit 00984af789
6 changed files with 11 additions and 11 deletions

View File

@ -104,7 +104,7 @@ class CrawlerController extends CommonController
$crawler = new InvenCrawler(getenv("inven.host.url"), $board_name, $user_entity); $crawler = new InvenCrawler(getenv("inven.host.url"), $board_name, $user_entity);
$crawler->isDebug = in_array('debug', $params); $crawler->isDebug = in_array('debug', $params);
$crawler->isCopy = in_array('copy', $params); $crawler->isCopy = in_array('copy', $params);
$crawler->execute(intval(getenv("inven.list.max_limit"))); $crawler->execute();
return "완료되었습니다."; return "완료되었습니다.";
} catch (\Exception $e) { } catch (\Exception $e) {
log_message("error", $e->getMessage()); log_message("error", $e->getMessage());

View File

@ -119,7 +119,7 @@ class InvenCrawler extends MangboardCrawler
// </tr> // </tr>
// </table> // </table>
// </div> // </div>
public function execute(int $max_limit): void public function execute(): void
{ {
try { try {
if ($this->isDebug) { if ($this->isDebug) {
@ -134,7 +134,7 @@ class InvenCrawler extends MangboardCrawler
} else { } else {
$listInfos = []; $listInfos = [];
$response = $this->getMySocket()->getContent(getenv("inven.list.url.{$this->getBoardName()}")); $response = $this->getMySocket()->getContent(getenv("inven.list.url.{$this->getBoardName()}"));
$this->getSelector($response, getenv("inven.list.tag"))->each( $this->getSelector($response, getenv("inven.list.tag.{$this->getBoardName()}"))->each(
function (Crawler $node) use (&$listInfos): void { function (Crawler $node) use (&$listInfos): void {
$hit = $node->filter(getenv("inven.list.item.hit.tag"))->text(); $hit = $node->filter(getenv("inven.list.item.hit.tag"))->text();
$date = date("Y") . "-" . $node->filter(getenv("inven.list.item.date.tag"))->text(); $date = date("Y") . "-" . $node->filter(getenv("inven.list.item.date.tag"))->text();
@ -149,7 +149,7 @@ class InvenCrawler extends MangboardCrawler
if (!count($listInfos)) { if (!count($listInfos)) {
throw new \Exception("Target URL이 없습니다."); throw new \Exception("Target URL이 없습니다.");
} }
$this->list_process($max_limit, $listInfos); $this->list_process(intval(getenv("inven.list.max_limit.{$this->getBoardName()}")), $listInfos);
} }
log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다."); log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다.");
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -26,7 +26,7 @@ abstract class MangboardCrawler extends MyCrawler
$this->_user_entity = $user_entity; $this->_user_entity = $user_entity;
} }
abstract protected function detail_process(int $cnt, array $listInfo): array; abstract protected function detail_process(int $cnt, array $listInfo): array;
abstract public function execute(int $max_limit): void; abstract public function execute(): void;
final protected function getMySocket() final protected function getMySocket()
{ {
if ($this->_mySocket === null) { if ($this->_mySocket === null) {

View File

@ -139,7 +139,7 @@ class SirCrawler extends MangboardCrawler
// <span class="info_span info_hit">244</span> // <span class="info_span info_hit">244</span>
// </div> // </div>
// </li> // </li>
public function execute(int $max_limit): void public function execute(): void
{ {
try { try {
if ($this->isDebug) { if ($this->isDebug) {
@ -170,7 +170,7 @@ class SirCrawler extends MangboardCrawler
if (!count($listInfos)) { if (!count($listInfos)) {
throw new \Exception("Target URL이 없습니다."); throw new \Exception("Target URL이 없습니다.");
} }
$this->list_process($max_limit, $listInfos); $this->list_process(intval(getenv("sir.list.max_limit")), $listInfos);
} }
log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다."); log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다.");
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -65,7 +65,7 @@ class YamapCrawler extends MangboardCrawler
// </div> // </div>
// <div id="freesubframe"></div> // <div id="freesubframe"></div>
// </div> // </div>
public function execute(int $max_limit): void public function execute(): void
{ {
try { try {
if ($this->isDebug) { if ($this->isDebug) {
@ -100,7 +100,7 @@ class YamapCrawler extends MangboardCrawler
if (!count($listInfos)) { if (!count($listInfos)) {
throw new \Exception("Target URL이 없습니다."); throw new \Exception("Target URL이 없습니다.");
} }
$this->list_process($max_limit, $listInfos); $this->list_process(intval(getenv("yamap.list.max_limit")), $listInfos);
} }
log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다."); log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다.");
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -87,7 +87,7 @@ class YamoonCrawler extends MangboardCrawler
// <i class="fa fa-commenting-o" aria-hidden="true"></i> <span class="color-red small">6</span> // <i class="fa fa-commenting-o" aria-hidden="true"></i> <span class="color-red small">6</span>
// <span class="visible-xs visible-sm small"><i class="fa fa-user-o" aria-hidden="true"></i> yeeyuu | <i class="fa fa-thumbs-o-up" aria-hidden="true"></i> 6 | <i class="fa fa-eye" aria-hidden="true"></i> 369 | No 89372 | 2024-09-13</span> // <span class="visible-xs visible-sm small"><i class="fa fa-user-o" aria-hidden="true"></i> yeeyuu | <i class="fa fa-thumbs-o-up" aria-hidden="true"></i> 6 | <i class="fa fa-eye" aria-hidden="true"></i> 369 | No 89372 | 2024-09-13</span>
// </td> // </td>
public function execute(int $max_limit): void public function execute(): void
{ {
try { try {
if ($this->isDebug) { if ($this->isDebug) {
@ -115,7 +115,7 @@ class YamoonCrawler extends MangboardCrawler
if (!count($listInfos)) { if (!count($listInfos)) {
throw new \Exception("Target URL이 없습니다."); throw new \Exception("Target URL이 없습니다.");
} }
$this->list_process($max_limit, $listInfos); $this->list_process(intval(getenv("yamoon.list.max_limit")), $listInfos);
} }
log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다."); log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다.");
} catch (\Exception $e) { } catch (\Exception $e) {