//
//

할아버지의 마술 정보

// // 할아버지의 마술 // //
//
// // // //
//

본문

//
//
// //
//

..

getMySocket()->getContent($listInfo['detail_url']); //작성시간 $selector = $this->getSelector($response, getenv("sir.view.date.tag")); //Date Format이 맞지않아 변경해주기위함 : 2024.09.13 00:24:04 -> 2024-09-13 00:24:04 $listInfo['date'] = trim($selector->text()); $listInfo['date'] = DateTime::createFromFormat('Y.m.d H:i:s', $listInfo['date']); $listInfo['date'] = $listInfo['date']->format('Y-m-d H:i:s'); // if ($this->getDebug()) { // throw new \Exception( // sprintf( // "\n--------------%s Debug--------------\n%s\n%s\n---------------------------------------\n", // __FUNCTION__, // var_export($listInfo, true), // $selector->html() // ) // ); // } //작성내용 $tag = getenv("sir.view.content.tag"); $selector = $this->getSelector($response, $tag, true); $media_urls = $this->getUrlsByMediaType("image", $selector, ["tag" => "img", "attr" => "src"]); $media_urls = $this->getUrlsByMediaType("video", $selector, ["tag" => "video", "attr" => "src"], $media_urls); if ($this->getDebug()) { throw new \Exception(sprintf( "\n--------------%s Debug--------------\n%s%s\n---------------------------------------\n", __FUNCTION__, var_export($listInfo, true), var_export($media_urls, true) )); } else { $storages = $this->media_process($media_urls); if (!count($storages)) { throw new \Exception("등록할 자료가 없습니다."); } $this->backend_process($cnt, $listInfo, $storages); } return $listInfo; } //리스트내용 //
  • //
    // 할아버지의 마술 3 //
    21967
    //
    // // // 감독님 // // 자기소개 // 아이디로 검색 // 회원게시물 // // // // // 24.09.13 // // // // 244 //
    //
  • public function execute(int $max_limit): void { try { $listInfos = []; if ($this->getDebug()) { $this->detail_page(1, ['detail_url' => getenv("sir.view.test.url")]); } $response = $this->getMySocket()->getContent(getenv("sir.list.url")); $this->getSelector($response, getenv("sir.list.tag"))->each( function (Crawler $node) use (&$listInfos): void { $link_node = $node->filter(getenv("sir.list.item.link.tag")); // href url의 맨 앞이 /가 두개라서 한개를 빼기위함 $detail_url = $this->getChangeURL($link_node->attr("href")); // $detail_url = $link_node->attr("href"); $title = $link_node->text(); $nickname = $node->filter(getenv("sir.list.item.nickname.tag"))->text(); $hit = $node->filter(getenv("sir.list.item.hit.tag"))->text(); // $date = $node->filter(getenv("sir.list.item.date.tag"))->text(); $listInfos[] = ['title' => $title, 'nickname' => $nickname, 'detail_url' => $detail_url, 'date' => "", 'hit' => $hit]; } ); // throw new \Exception("Target URL이 없습니다." . var_export($listInfos, true)); if (!count($listInfos)) { throw new \Exception("Target URL이 없습니다."); } $this->main_process($max_limit, $listInfos); log_message("notice", __FUNCTION__ . " 작업이 완료되었습니다."); } catch (\Exception $e) { log_message("warning", sprintf( "\n---%s 오류---\n%s\n-----------------------------------------\n", __FUNCTION__, $e->getMessage() )); } } }