diff --git a/packt.html b/packt.html new file mode 100644 index 0000000..540f2ee --- /dev/null +++ b/packt.html @@ -0,0 +1,55636 @@ + + + Packt Publishing | Technology Books, eBooks & Videos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
Account Options
+ + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/packt.php b/packt.php index 392deb8..4019761 100644 --- a/packt.php +++ b/packt.php @@ -44,15 +44,30 @@ function c($url, $post = []) } -$return = c('https://www.packtpub.com/', $loginData); -$return = c('https://www.packtpub.com/account/my-ebooks'); +//$return = c('https://www.packtpub.com/', $loginData); +//$return = c('https://www.packtpub.com/account/my-ebooks'); //var_dump($return); -$document = new Document($return); +//var_dump($return); +//$document = new Document($return); + +$document = new Document('packt.html', true); $booksData = []; $books = $document->find('.product-line.unseen'); foreach ($books as $book) { - $booksData[] = trim($book->first('.title::text')); + +// print_r($book->html()); + $bookData = []; + $bookData['title'] = str_replace(["\r\n"], '', trim($book->first('.title::text'))); + $bookData['nid'] = (int)$book->attr('nid'); + + $bookData['pdf'] = $book->first('a[href$=pdf]::attr(href)'); + $bookData['epub'] = $book->first('a[href$=epub]::attr(href)'); + $bookData['mobi'] = $book->first('a[href$=mobi]::attr(href)'); + $bookData['code'] = $book->first('a[href*=code_download]::attr(href)'); + + $booksData[] = $bookData; + } print_r($booksData);