|
@@ -1,4 +1,4 @@ discard block |
|
|
block discarded – undo |
|
1
|
|
-<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
|
1
|
+<?php declare(strict_types = 1); defined('BASEPATH') OR exit('No direct script access allowed'); |
|
2
|
2
|
|
|
3
|
3
|
abstract class Site_Model extends CI_Model { |
|
4
|
4
|
public $site = ''; |
|
@@ -32,7 +32,7 @@ discard block |
|
|
block discarded – undo |
|
32
|
32
|
final protected function get_content(string $url, string $cookie_string = "", string $cookiejar_path = "", bool $follow_redirect = FALSE) { |
|
33
|
33
|
$ch = curl_init(); |
|
34
|
34
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
35
|
|
- curl_setopt($ch, CURLOPT_ENCODING , "gzip"); |
|
|
35
|
+ curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
36
|
36
|
//curl_setopt($ch, CURLOPT_VERBOSE, 1); |
|
37
|
37
|
curl_setopt($ch, CURLOPT_HEADER, 1); |
|
38
|
38
|
|
|
@@ -110,7 +110,7 @@ discard block |
|
|
block discarded – undo |
|
110
|
110
|
$nodes_row = $xpath->query($node_row_string); |
|
111
|
111
|
if($nodes_title->length === 1 && $nodes_row->length === 1) { |
|
112
|
112
|
$firstRow = $nodes_row->item(0); |
|
113
|
|
- $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
|
113
|
+ $nodes_latest = $xpath->query($node_latest_string, $firstRow); |
|
114
|
114
|
|
|
115
|
115
|
if($node_chapter_string !== '') { |
|
116
|
116
|
$nodes_chapter = $xpath->query($node_chapter_string, $firstRow); |
|
@@ -236,8 +236,8 @@ discard block |
|
|
block discarded – undo |
|
236
|
236
|
|
|
237
|
237
|
$link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
238
|
238
|
$chapterURLSegments = explode('/', $link); |
|
239
|
|
- $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
240
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
|
239
|
+ $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
|
240
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
241
|
241
|
} |
|
242
|
242
|
|
|
243
|
243
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -280,8 +280,8 @@ discard block |
|
|
block discarded – undo |
|
280
|
280
|
|
|
281
|
281
|
$link = preg_replace('/^(.*\/)(?:[0-9]+\.html)?$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
282
|
282
|
$chapterURLSegments = explode('/', $link); |
|
283
|
|
- $titleData['latest_chapter'] = $chapterURLSegments[5] . (isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
284
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
|
283
|
+ $titleData['latest_chapter'] = $chapterURLSegments[5].(isset($chapterURLSegments[6]) && !empty($chapterURLSegments[6]) ? "/{$chapterURLSegments[6]}" : ""); |
|
|
284
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
285
|
285
|
} |
|
286
|
286
|
|
|
287
|
287
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -312,7 +312,7 @@ discard block |
|
|
block discarded – undo |
|
312
|
312
|
|
|
313
|
313
|
$chapter_parts = explode(':--:', $chapter); |
|
314
|
314
|
return [ |
|
315
|
|
- 'url' => "http://bato.to/reader#" . $chapter_parts[0], |
|
|
315
|
+ 'url' => "http://bato.to/reader#".$chapter_parts[0], |
|
316
|
316
|
'number' => $chapter_parts[1] |
|
317
|
317
|
]; |
|
318
|
318
|
} |
|
@@ -347,13 +347,13 @@ discard block |
|
|
block discarded – undo |
|
347
|
347
|
|
|
348
|
348
|
///^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)(?:\s?-\s?(?<extra>[0-9]+))?):?.*/ |
|
349
|
349
|
preg_match('/^(?:Vol\.(?<volume>\S+) )?(?:Ch.(?<chapter>[^\s:]+)(?:\s?-\s?(?<extra>[0-9]+))?):?.*/', trim($data['nodes_chapter']->nodeValue), $text); |
|
350
|
|
- $titleData['latest_chapter'] = substr($data['nodes_chapter']->getAttribute('href'), 22) . ':--:' . ((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '') . 'c'.$text['chapter'] . (!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
|
350
|
+ $titleData['latest_chapter'] = substr($data['nodes_chapter']->getAttribute('href'), 22).':--:'.((!empty($text['volume']) ? 'v'.$text['volume'].'/' : '').'c'.$text['chapter'].(!empty($text['extra']) ? '-'.$text['extra'] : '')); |
|
351
|
351
|
|
|
352
|
352
|
$dateString = $data['nodes_latest']->nodeValue; |
|
353
|
353
|
if($dateString == 'An hour ago') { |
|
354
|
354
|
$dateString = '1 hour ago'; |
|
355
|
355
|
} |
|
356
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
|
356
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(preg_replace('/ (-|\[A\]).*$/', '', $dateString))); |
|
357
|
357
|
} |
|
358
|
358
|
|
|
359
|
359
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -392,7 +392,7 @@ discard block |
|
|
block discarded – undo |
|
392
|
392
|
*/ |
|
393
|
393
|
|
|
394
|
394
|
$chapterData = [ |
|
395
|
|
- 'url' => 'http://dynasty-scans.com/chapters/' . $title_parts[0].'_'.$chapter, |
|
|
395
|
+ 'url' => 'http://dynasty-scans.com/chapters/'.$title_parts[0].'_'.$chapter, |
|
396
|
396
|
'number' => '' |
|
397
|
397
|
]; |
|
398
|
398
|
|
|
@@ -448,7 +448,7 @@ discard block |
|
|
block discarded – undo |
|
448
|
448
|
$chapterURLSegments = explode('/', (string) $data['nodes_chapter']->getAttribute('href')); |
|
449
|
449
|
$titleData['latest_chapter'] = $chapterURLSegments[2]; |
|
450
|
450
|
|
|
451
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace("'", '', substr((string) $data['nodes_latest']->textContent, 9)))); |
|
|
451
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime(str_replace("'", '', substr((string) $data['nodes_latest']->textContent, 9)))); |
|
452
|
452
|
} |
|
453
|
453
|
break; |
|
454
|
454
|
|
|
@@ -458,7 +458,7 @@ discard block |
|
|
block discarded – undo |
|
458
|
458
|
|
|
459
|
459
|
preg_match('/<b>.*<\/b>/', $data, $matchesT); |
|
460
|
460
|
preg_match('/\/doujins\/[^"]+">(.+)?(?=<\/a>)<\/a>/', $data, $matchesD); |
|
461
|
|
- $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '') . substr($matchesT[0], 3, -4); |
|
|
461
|
+ $titleData['title'] = (!empty($matchesD) ? ($matchesD[1] !== 'Original' ? $matchesD[1].' - ' : '') : '').substr($matchesT[0], 3, -4); |
|
462
|
462
|
|
|
463
|
463
|
$titleData['latest_chapter'] = 'oneshot'; //This will never change |
|
464
|
464
|
|
|
@@ -514,7 +514,7 @@ discard block |
|
|
block discarded – undo |
|
514
|
514
|
|
|
515
|
515
|
$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
516
|
516
|
|
|
517
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
|
517
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
518
|
518
|
} |
|
519
|
519
|
|
|
520
|
520
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -557,7 +557,7 @@ discard block |
|
|
block discarded – undo |
|
557
|
557
|
|
|
558
|
558
|
$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
559
|
559
|
|
|
560
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
|
560
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue)); |
|
561
|
561
|
} |
|
562
|
562
|
|
|
563
|
563
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -616,8 +616,8 @@ discard block |
|
|
block discarded – undo |
|
616
|
616
|
$titleData['title'] = trim((string) $xml->{'channel'}->title); |
|
617
|
617
|
|
|
618
|
618
|
$chapterURLSegments = explode('/', ((string) $xml->{'channel'}->item[0]->link)); |
|
619
|
|
- $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]) . ':--:' . $chapterURLSegments[6]; |
|
620
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate)); |
|
|
619
|
+ $titleData['latest_chapter'] = preg_replace('/^.*?([0-9]+)$/', '$1', $chapterURLSegments[7]).':--:'.$chapterURLSegments[6]; |
|
|
620
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $xml->{'channel'}->item[0]->pubDate)); |
|
621
|
621
|
} |
|
622
|
622
|
} else { |
|
623
|
623
|
log_message('error', "Series missing? (WebToons): {$title_url}"); |
|
@@ -688,13 +688,13 @@ discard block |
|
|
block discarded – undo |
|
688
|
688
|
$titleData['title'] = $nodes_title->item(0)->textContent; |
|
689
|
689
|
|
|
690
|
690
|
$firstRow = $nodes_row->item(0); |
|
691
|
|
- $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
|
691
|
+ $nodes_latest = $xpath->query("td[2]", $firstRow); |
|
692
|
692
|
$nodes_chapter = $xpath->query("td[1]/a", $firstRow); |
|
693
|
693
|
|
|
694
|
694
|
$link = (string) $nodes_chapter->item(0)->getAttribute('href'); |
|
695
|
695
|
$chapterURLSegments = explode('/', preg_replace('/\?.*$/', '', $link)); |
|
696
|
|
- $titleData['latest_chapter'] = $chapterURLSegments[3] . ':--:' . preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
697
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->textContent)); |
|
|
696
|
+ $titleData['latest_chapter'] = $chapterURLSegments[3].':--:'.preg_replace('/.*?([0-9]+)$/', '$1', $link); |
|
|
697
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) $nodes_latest->item(0)->textContent)); |
|
698
|
698
|
} |
|
699
|
699
|
} else { |
|
700
|
700
|
//TODO: Throw ERRORS; |
|
@@ -718,7 +718,7 @@ discard block |
|
|
block discarded – undo |
|
718
|
718
|
The bad thing is these are interchangeable, despite them showing the exact same listing page. |
|
719
|
719
|
Thankfully the title_url of manga which use /forums/ seem to be appended with ".%ID%" which means we can easily check them. */ |
|
720
|
720
|
|
|
721
|
|
- if (strpos($title_url, '.') !== FALSE) { |
|
|
721
|
+ if(strpos($title_url, '.') !== FALSE) { |
|
722
|
722
|
$format = "https://gameofscanlation.moe/forums/{$title_url}/"; |
|
723
|
723
|
} else { |
|
724
|
724
|
$format = "https://gameofscanlation.moe/projects/{$title_url}/"; |
|
@@ -753,7 +753,7 @@ discard block |
|
|
block discarded – undo |
|
753
|
753
|
|
|
754
|
754
|
$titleData['latest_chapter'] = preg_replace('/^projects\/.*?\/(.*?)\/$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
755
|
755
|
|
|
756
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s",(int) $data['nodes_latest']->getAttribute('title')); |
|
|
756
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", (int) $data['nodes_latest']->getAttribute('title')); |
|
757
|
757
|
} |
|
758
|
758
|
|
|
759
|
759
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -797,7 +797,7 @@ discard block |
|
|
block discarded – undo |
|
797
|
797
|
|
|
798
|
798
|
$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)\/$/', '$1', (string) $data['nodes_chapter']->getAttribute('href')); |
|
799
|
799
|
|
|
800
|
|
- $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($data['nodes_latest']->getAttribute('title'), 13))); |
|
|
800
|
+ $titleData['last_updated'] = date("Y-m-d H:i:s", strtotime((string) substr($data['nodes_latest']->getAttribute('title'), 13))); |
|
801
|
801
|
} |
|
802
|
802
|
|
|
803
|
803
|
return (!empty($titleData) ? $titleData : NULL); |
|
@@ -818,7 +818,7 @@ discard block |
|
|
block discarded – undo |
|
818
|
818
|
$chapter_parts = explode('/', $chapter); |
|
819
|
819
|
return [ |
|
820
|
820
|
'url' => "https://reader.kireicake.com/read/{$title_url}/{$chapter}/", |
|
821
|
|
- 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
|
821
|
+ 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
822
|
822
|
]; |
|
823
|
823
|
} |
|
824
|
824
|
|
|
@@ -842,7 +842,7 @@ discard block |
|
|
block discarded – undo |
|
842
|
842
|
$chapter_parts = explode('/', $chapter); |
|
843
|
843
|
return [ |
|
844
|
844
|
'url' => "https://reader.seaotterscans.com/read/{$title_url}/{$chapter}/", |
|
845
|
|
- 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
|
845
|
+ 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
846
|
846
|
]; |
|
847
|
847
|
} |
|
848
|
848
|
|
|
@@ -866,7 +866,7 @@ discard block |
|
|
block discarded – undo |
|
866
|
866
|
$chapter_parts = explode('/', $chapter); |
|
867
|
867
|
return [ |
|
868
|
868
|
'url' => "http://helveticascans.com/reader/read/{$title_url}/{$chapter}/", |
|
869
|
|
- 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
|
869
|
+ 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
870
|
870
|
]; |
|
871
|
871
|
} |
|
872
|
872
|
|
|
@@ -890,7 +890,7 @@ discard block |
|
|
block discarded – undo |
|
890
|
890
|
$chapter_parts = explode('/', $chapter); |
|
891
|
891
|
return [ |
|
892
|
892
|
'url' => "http://reader.sensescans.com/read/{$title_url}/{$chapter}/", |
|
893
|
|
- 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
|
893
|
+ 'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '')."c{$chapter_parts[2]}".(isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/ |
|
894
|
894
|
]; |
|
895
|
895
|
} |
|
896
|
896
|
|