_category = $category; $this->_user_entity = $user_entity; } final protected function getMyStorage() { if ($this->_myStorage === null) { $this->_myStorage = new MangboardStorage($this->_category, $this->_user_entity); } return $this->_myStorage; } protected function detail_page(int $cnt, array $listInfo): void { $response = $this->getMySocket()->getContent("/newboard/yamoonboard/" . $listInfo['detail_url']); //작성시간 // $selector = $this->getSelector($response, getenv("yamoon.view.regdate.tag")); // $listInfo['date'] = trim($selector->text()); //작성내용 $tag = getenv("yamoon.view.content.tag"); list($listInfo, $media_urls) = $this->getMediaUrls($response, $tag, $listInfo); //Image 나 Video 소스들의 url을 가져와서 실제 다운받는 처리 $storages = $this->media_process($media_urls); if (!count($storages)) { throw new \Exception("등록할 자료가 없습니다."); } //File DB 및 Board DB 등록작업등 $baord_name = "board_" . $this->_category; $boardsModel = new BoardsModel(); $boards_entity = $boardsModel->getEntityByID("board_" . $this->_category); if ($boards_entity === null) { throw new \Exception("boards에서 {$baord_name} 해당정보를 찾을수 없습니다."); } $boardModel = new BoardModel("mb_" . $baord_name); $board_entity = $boardModel->createByCrawler( $boards_entity, $this->_user_entity, $cnt, $listInfo, $storages ); if ($board_entity === null) { throw new \Exception("{$baord_name} 생성에 오류가 발생했습니다."); } $fileModel = new FileModel(); $fileModel->createByCrawler( $boards_entity, $this->_user_entity, $board_entity, $boardModel->getTable(), $storages ); $this->create_small_ImageTrait($board_entity, $storages); } public function execute(int $max_limit): void { try { $listInfos = []; if ($this->getDebug()) { $listInfos = [ 'title' => getenv("yamoon.view.test.title"), 'nickname' => getenv("yamoon.view.test.nickname"), 'detail_url' => getenv("yamoon.view.test.url"), 'time' => date("Y-m-d H:i:s"), 'hit' => 1, ]; } else { $response = $this->getMySocket()->getContent(getenv("yamoon.list.url.{$this->_category}")); //div.bbs_item를 가진 객체를 찾아서 같은 형식의 객체(sibling)를 배열로 넘김 // log_message("debug", sprintf("\n-------------MainPage------------\n%s\n--------------------------\n", $selector->html())); //