setDebug($isDebug); //1. MainPage $url = getenv("yamap.list.url"); $crawler = $library->getCrawler($url, getenv("yamap.list.tag")); $urls = $library->getListURLs( $crawler, getenv("yamap.list.item.tag"), getenv("yamap.list.item.subject.tag"), getenv("yamap.list.item.nickname.tag"), getenv("yamap.list.item.nickname.skip") ); if (!count($urls)) { throw new \Exception("Target URL이 없습니다."); } //2. TargetPage : div.contents 가진 객체를 찾아서 첫번쨰 요소에서만 참조 $url = $isDebug ? getenv("yamap.view.test.url") : $urls[0]; $crawler = $library->getCrawler($url, getenv("yamap.view.content.tag")); //3. Image $library->download($crawler, ["tag" => "img", "attr" => "src"]); //4. Video $library->download($crawler, ["tag" => "video", "attr" => "src"]); log_message("info", "완료되었습니다."); return true; } catch (\Exception $e) { log_message("error", $e->getMessage()); return false; } } }