getMySocket()->getContent($listInfo['detail_url']); return array($this->getSelector($response, getenv("yamap.view.content.tag")), $listInfo); } //리스트내용 //
final public function execute(): void { $listInfos = []; if ($this->isDebug) { $listInfo = []; $listInfo['title'] = 'test_title'; $listInfo['nickname'] = 'test_name'; $listInfo['hit'] = 1; $listInfo['date'] = date("Y-m-d H:i:s"); $listInfo['detail_url'] = getenv("yamap.view.test.url.{$this->getMyStorage()->getBoardName()}"); $listInfos[] = $listInfo; } else { $response = $this->getMySocket()->getContent(getenv("yamap.list.url.{$this->getMyStorage()->getBoardName()}")); $this->getSelector($response, getenv("yamap.list.tag.{$this->getMyStorage()->getBoardName()}"))->each( function (Crawler $node) use (&$listInfos): void { $nickname = $node->filter(getenv("yamap.list.item.nickname.tag"))->text(); $hit = $node->filter(getenv("yamap.list.item.hit.tag"))->text(); $date = $node->filter(getenv("yamap.list.item.date.tag"))->text(); //title및 detail url $link_node = $node->filter(getenv("yamap.list.item.link.tag")); $detail_url = $link_node->attr("href"); $title = $link_node->children()->last()->text(); //title에서 예외사항비교 if (strpos($title, getenv("yamap.list.tag.except.{$this->getMyStorage()->getBoardName()}")) === false) { $listInfos[] = ['title' => $title, 'nickname' => $nickname, 'detail_url' => $detail_url, 'date' => $date, 'hit' => $hit]; } } ); } if (!count($listInfos)) { throw new \Exception("Target URL이 없습니다."); } $this->list_process(intval(getenv("yamap.list.max_limit.{$this->getMyStorage()->getBoardName()}")), $listInfos); log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다."); } }