Automation init...3
This commit is contained in:
parent
17f7065f7b
commit
32c58a2f76
@ -43,7 +43,9 @@ class YamapController extends CommonController
|
||||
//3. DetailPage 처리 : bbs_view > div.contents 가진 객체를 찾아서 처리
|
||||
$fileEntitys = $crawler->detailPage($item["detail_url"]);
|
||||
//4.망보드 일반게시판에 게시물 등록 처리
|
||||
$crawler->createBoard($item, $fileEntitys);
|
||||
if (count($fileEntitys)) {
|
||||
$crawler->createBoard($item, $fileEntitys);
|
||||
}
|
||||
$i++;
|
||||
log_message("notice", "게시물 {$i}번째 {$item["nickname"]} 작업완료.");
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -37,23 +37,22 @@ abstract class MyCrawlerLibrary extends CommonLibrary
|
||||
|
||||
|
||||
//Download한 파일 저장후 추가작업시 사용
|
||||
protected function download_process($entity, int $file_sequence)
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
|
||||
final protected function download(string $mediaType, Crawler $crawler, array $options, array $entitys = []): array
|
||||
{
|
||||
$nodes = $this->getNodes($crawler, $options);
|
||||
$file_sequence = 1;
|
||||
foreach ($nodes as $node) {
|
||||
list($fileName, $content) = $this->getMySocket()->download($node->attr($options["attr"]));
|
||||
$entity = $this->getMyStorage()->save($fileName, $mediaType, $content, $file_sequence);
|
||||
if ($entity === null) {
|
||||
continue;
|
||||
try {
|
||||
list($fileName, $content) = $this->getMySocket()->download($node->attr($options["attr"]));
|
||||
$entity = $this->getMyStorage()->save($fileName, $mediaType, $content, $file_sequence);
|
||||
if ($entity === null) {
|
||||
continue;
|
||||
}
|
||||
$entitys[] = $entity;
|
||||
$file_sequence++;
|
||||
} catch (\Exception $e) {
|
||||
log_message("notice", $e->getMessage());
|
||||
}
|
||||
$entitys[] = $this->download_process($entity, $file_sequence);
|
||||
$file_sequence++;
|
||||
}
|
||||
return $entitys;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user