Before running parse operation on search results page it checks now if there are any books to parse.
This commit is contained in:
@@ -49,6 +49,7 @@ class DataParser
|
|||||||
$books = $document->find('#search .authorAllBooks__single');
|
$books = $document->find('#search .authorAllBooks__single');
|
||||||
|
|
||||||
$booksInfo = [];
|
$booksInfo = [];
|
||||||
|
if ($document->has('#searchksiazki')) {
|
||||||
foreach ($books as $book) {
|
foreach ($books as $book) {
|
||||||
$bookInfo = new Info();
|
$bookInfo = new Info();
|
||||||
$bookInfo->title = trim($book->first('.authorAllBooks__singleTextTitle')->text());
|
$bookInfo->title = trim($book->first('.authorAllBooks__singleTextTitle')->text());
|
||||||
@@ -57,6 +58,7 @@ class DataParser
|
|||||||
$bookInfo->cover_url = $this->generateCoverUrls($book->first('.img-fluid')->getAttribute('data-src'));
|
$bookInfo->cover_url = $this->generateCoverUrls($book->first('.img-fluid')->getAttribute('data-src'));
|
||||||
$booksInfo[] = $bookInfo;
|
$booksInfo[] = $bookInfo;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $booksInfo;
|
return $booksInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user