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');
|
||||
|
||||
$booksInfo = [];
|
||||
if ($document->has('#searchksiazki')) {
|
||||
foreach ($books as $book) {
|
||||
$bookInfo = new Info();
|
||||
$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'));
|
||||
$booksInfo[] = $bookInfo;
|
||||
}
|
||||
}
|
||||
return $booksInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user