Before running parse operation on search results page it checks now if there are any books to parse.

This commit is contained in:
krzysiej
2022-05-30 11:54:32 +02:00
parent 293a776d16
commit 475c200b67

View File

@@ -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;
}