Book authors, bio, table of content and what will learn section.

This commit is contained in:
krzysiej
2018-04-10 16:02:37 +02:00
parent 90b1d46197
commit db1aed0ee3

View File

@@ -50,7 +50,6 @@ function getBookInfo($bookUrl)
// $bookPage = c($bookUrl);
$bookData = [];
$bookPage = new Document($bookUrl, true);
$bookData['authors'] = $bookPage->find('.book-top-block-info-authors::text');
$bookData['datepublished'] = $bookPage->first('.book-top-block-info-authors')->first('time[itemprop="datePublished"]::attr(datetime)');
$bookData['numberofpages'] = $bookPage->first('span[itemprop="numberOfPages"]::text');
$bookData['isbn'] = $bookPage->first('span[itemprop="isbn"]::text');
@@ -68,6 +67,17 @@ function getBookInfo($bookUrl)
}
}
$bookData['description'] = $bookPage->first('div.book-info-bottom-indetail-text[itemprop="description"]')->find('p::text');
$bookData['willLearn'] = $bookPage->first('div.book-info-will-learn-text')->find('li::text');
$bookData['authors'] = [];
foreach ($bookPage->find('[itemprop="author"]') as $author) {
$authorData = [];
$authorData['name'] = $author->first('h3::text');
$authorData['bio'] = $author->find('p::text');
$bookData['authors'][] = $authorData;
}
return $bookData;
}