-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmangaupdates.php
112 lines (101 loc) · 3.12 KB
/
mangaupdates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
//require '../simple_html_dom/simple_html_dom.php';
$url="";
$html="";
function getMUSynopsisForTitle($title) {
global $url,$html;
$url = getUrlForSearch($title);
//echo $url;
if(!strpos($url,"https://www.mangaupdates.com/series.html?id=")){
$url = getUrlForSearch(str_replace("'","",$title));
}
if($url){
$html = str_get_html(getHtmlForUrl($url));
$data = $html->find('html body td.text div div.sContainer div.sMember div.sContent',0)->innertext;
$data = strip_tags($data,"<br>");
return $data;}
else {
return "";
}
}
function getAltForTitle($title) {
global $url,$html;
$data = $html->find('html body td.text div div.sContainer div.sMember div.sContent',3)->innertext;
$data = strip_tags($data,"<br>");
return $data;
}
function getAuthForTitle($title) {
global $url,$html;
$data = $html->find('html body td.text div div.sContainer div.sMember div.sContent',18)->innertext;
$author = strip_tags($data,"<br>");
$data = $html->find('html body td.text div div.sContainer div.sMember div.sContent',19)->innertext;
$illus = strip_tags($data,"<br>");
return array($author,$illus);
}
function getGenreForTitle($title) {
global $url,$html;
$data = $html->find('html body td.text div div.sContainer div.sMember div.sContent',14)->innertext;
$data = strip_tags($data,"<br>");
$data = str_replace("Search for series of same genre(s)","",$data);
return $data;
}
function getDateForTitle($title) {
global $url,$html;
$data = $html->find('html body td.text div div.sContainer div.sMember div.sContent',20)->innertext;
$data = strip_tags($data,"<br>");
return $data;
}
function getUrlForSearch($title){
$html = searchTitle($title);
$html = str_get_html($html);
$data = $html->find('html body div table.text tbody tr td.text a',0)->plaintext;
/*if(strtoupper($title) == strtoupper($data) || strtoupper($title." (NOVEL)") == strtoupper($data)){
$data = $html->find('html body div table.text tbody tr td.text a',0)->href;
return $data;
} else {
return false;
}*/
$data = $html->find('html body div table.text tbody tr td.text a',0)->href;
return $data;
}
function searchTitle($title){
$url = "https://www.mangaupdates.com/series.html";
$fields = array(
'act' => "series",
'stype' => "title",
'search' => $title,
'x' => '26',
'y' => '15',
'session' => ''
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
file_put_contents("mu_result.html",$result);
return $result;
}
function getHtmlForUrl($url){
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
file_put_contents("mu_url.html",$result);
return $result;
}
//getMUSynopsisForTitle("Zhan Long");
?>