|
1
|
|
|
<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2
|
|
|
|
|
3
|
|
|
class JaiminisBox extends Base_FoolSlide_Site_Model { |
|
4
|
|
|
public $baseURL = 'https://jaiminisbox.com/reader'; |
|
5
|
|
|
|
|
6
|
|
|
//NOTE: Jaimini's Box appears to have disabled API support for some reason. Fallback to using the old method. |
|
7
|
|
|
public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array { |
|
8
|
|
|
$fullURL = $this->getFullTitleURL($title_url); |
|
9
|
|
|
$titleData = []; |
|
10
|
|
|
if($content = $this->get_content($fullURL, "", "", FALSE, TRUE, ['adult' => 'true'])) { |
|
11
|
|
|
$content['body'] = preg_replace('/^[\S\s]*(<article[\S\s]*)<\/article>[\S\s]*$/', '$1', $content['body']); |
|
12
|
|
|
$data = $this->parseTitleDataDOM( |
|
13
|
|
|
$content, |
|
14
|
|
|
$title_url, |
|
15
|
|
|
"//div[@class='large comic']/h1[@class='title']", |
|
16
|
|
|
"(//div[@class='list']/div[@class='group']/div[@class='title' and text() = 'Chapters']/following-sibling::div[@class='element'][1] | //div[@class='list']/div[@class='element'][1] | //div[@class='list']/div[@class='group'][1]/div[@class='element'][1])[1]", |
|
17
|
|
|
"div[@class='meta_r']", |
|
18
|
|
|
"div[@class='title']/a" |
|
19
|
|
|
); |
|
20
|
|
|
if($data) { |
|
21
|
|
|
$titleData['title'] = trim($data['nodes_title']->textContent); |
|
22
|
|
|
$link = (string) $data['nodes_chapter']->getAttribute('href'); |
|
23
|
|
|
$titleData['latest_chapter'] = preg_replace('/.*\/read\/.*?\/(.*?)\/$/', '$1', $link); |
|
24
|
|
|
$titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) str_replace('.', '', explode(',', $data['nodes_latest']->nodeValue)[1]))); |
|
25
|
|
|
} |
|
26
|
|
|
} |
|
27
|
|
|
return (!empty($titleData) ? $titleData : NULL); |
|
28
|
|
|
} |
|
29
|
|
|
public function doCustomUpdate() {} |
|
30
|
|
|
} |
|
31
|
|
|
|