1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Blacklight\processing\adult; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class ADE |
7
|
|
|
*/ |
8
|
|
|
class ADE extends AdultMovies |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* If a direct link is given parse it rather then search. |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $directLink = ''; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Search keyword. |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
protected $searchTerm = ''; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Define ADE Url here. |
24
|
|
|
*/ |
25
|
|
|
private const ADE = 'http://www.adultdvdempire.com'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Direct Url returned in getAll method. |
29
|
|
|
* |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $_directUrl = ''; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Sets the title in the getAll method. |
36
|
|
|
* |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $_title = ''; |
40
|
|
|
|
41
|
|
|
/** Trailing urls */ |
42
|
|
|
protected $_dvdQuery = '/dvd/search?q='; |
43
|
|
|
protected $_scenes = '/scenes'; |
44
|
|
|
protected $_boxCover = '/boxcover'; |
45
|
|
|
protected $_backCover = '/backcover'; |
46
|
|
|
protected $_reviews = '/reviews'; |
47
|
|
|
protected $_trailers = '/trailers'; |
48
|
|
|
|
49
|
|
|
protected $_url; |
50
|
|
|
protected $_response; |
51
|
|
|
protected $_res = []; |
52
|
|
|
protected $_tmpResponse; |
53
|
|
|
protected $_ch; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Gets Trailer Movies. |
57
|
|
|
* @return array - url, streamid, basestreamingurl |
58
|
|
|
*/ |
59
|
|
|
protected function trailers() |
60
|
|
|
{ |
61
|
|
|
$this->_response = getRawHtml(self::ADE.$this->_trailers.$this->_directUrl); |
62
|
|
|
$this->_html->loadHtml($this->_response); |
|
|
|
|
63
|
|
|
if (preg_match("/(\"|')(?P<swf>[^\"']+.swf)(\"|')/i", $this->_response, $matches)) { |
|
|
|
|
64
|
|
|
$this->_res['trailers']['url'] = self::ADE.trim(trim($matches['swf']), '"'); |
65
|
|
|
if (preg_match( |
66
|
|
|
'#(?:streamID:\s\")(?P<streamid>[0-9A-Z]+)(?:\")#', |
67
|
|
|
$this->_response, |
68
|
|
|
$matches |
69
|
|
|
) |
70
|
|
|
) { |
71
|
|
|
$this->_res['trailers']['streamid'] = trim($matches['streamid']); |
72
|
|
|
} |
73
|
|
|
if (preg_match( |
74
|
|
|
'#(?:BaseStreamingUrl:\s\")(?P<baseurl>[\d]+.[\d]+.[\d]+.[\d]+)(?:\")#', |
75
|
|
|
$this->_response, |
76
|
|
|
$matches |
77
|
|
|
) |
78
|
|
|
) { |
79
|
|
|
$this->_res['trailers']['baseurl'] = $matches['baseurl']; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
return $this->_res; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Gets cover images for the xxx release. |
88
|
|
|
* @return array - Boxcover and backcover |
89
|
|
|
*/ |
90
|
|
|
protected function covers() |
91
|
|
|
{ |
92
|
|
|
if ($ret = $this->_html->find('div#Boxcover, img[itemprop=image]', 1)) { |
93
|
|
|
$this->_res['boxcover'] = preg_replace('/m\.jpg/', 'h.jpg', $ret->src); |
94
|
|
|
$this->_res['backcover'] = preg_replace('/m\.jpg/', 'bh.jpg', $ret->src); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
return $this->_res; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Gets the synopsis. |
102
|
|
|
* |
103
|
|
|
* @return array - plot |
104
|
|
|
*/ |
105
|
|
|
protected function synopsis() |
106
|
|
|
{ |
107
|
|
|
$ret = $this->_html->findOne('meta[name=og:description]')->content; |
108
|
|
|
if ($ret !== false) { |
|
|
|
|
109
|
|
|
$this->_res['synopsis'] = trim($ret); |
|
|
|
|
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
return $this->_res; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Gets the cast members and/or awards. |
117
|
|
|
* |
118
|
|
|
* |
119
|
|
|
* @return array - cast, awards |
120
|
|
|
*/ |
121
|
|
|
protected function cast() |
122
|
|
|
{ |
123
|
|
|
$cast = []; |
124
|
|
|
foreach ($this->_html->find('h3') as $a) { |
125
|
|
|
if ($a->plaintext !== false) { |
126
|
|
|
$cast[] = trim($a->plaintext); |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
$this->_res['cast'] = $cast; |
130
|
|
|
|
131
|
|
|
return $this->_res; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Gets Genres, if exists return array else return false. |
136
|
|
|
* @return mixed array - Genres |
137
|
|
|
*/ |
138
|
|
|
protected function genres() |
139
|
|
|
{ |
140
|
|
|
$genres = []; |
141
|
|
|
foreach ($this->_html->find('[Label="Category"]') as $a) { |
142
|
|
|
if ($a->plaintext !== false) { |
143
|
|
|
$genres[] = trim($a->plaintext); |
144
|
|
|
} |
145
|
|
|
} |
146
|
|
|
$this->_res['genres'] = $genres; |
147
|
|
|
|
148
|
|
|
return $this->_res; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Gets Product Information and/or Features. |
153
|
|
|
* |
154
|
|
|
* @param bool $extras |
155
|
|
|
* @return array - ProductInfo/Extras = features |
156
|
|
|
*/ |
157
|
|
|
protected function productInfo($extras = false) |
158
|
|
|
{ |
159
|
|
|
$dofeature = null; |
160
|
|
|
$this->_tmpResponse = str_ireplace('Section ProductInfo', 'spdinfo', $this->_response); |
161
|
|
|
$this->_html->loadHtml($this->_tmpResponse); |
162
|
|
|
if ($ret = $this->_html->findOne('div[class=spdinfo]')) { |
163
|
|
|
$this->_tmpResponse = trim($ret->outertext); |
164
|
|
|
$ret = $this->_html->loadHtml($this->_tmpResponse); |
165
|
|
|
foreach ($ret->find('text') as $strong) { |
166
|
|
|
if (trim($strong->innertext) === 'Features') { |
167
|
|
|
$dofeature = true; |
168
|
|
|
} |
169
|
|
|
if ($dofeature !== true) { |
170
|
|
|
if (trim($strong->innertext) !== ' ') { |
171
|
|
|
$this->_res['productinfo'][] = trim($strong->innertext); |
172
|
|
|
} |
173
|
|
|
} else { |
174
|
|
|
if ($extras === true) { |
175
|
|
|
$this->_res['extras'][] = trim($strong->innertext); |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
array_shift($this->_res['productinfo']); |
181
|
|
|
array_shift($this->_res['productinfo']); |
182
|
|
|
$this->_res['productinfo'] = array_chunk($this->_res['productinfo'], 2, false); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
return $this->_res; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Searches xxx name. |
190
|
|
|
* |
191
|
|
|
* @param string $movie |
192
|
|
|
* |
193
|
|
|
* @return bool - True if releases has 90% match, else false |
194
|
|
|
*/ |
195
|
|
|
public function processSite($movie): bool |
196
|
|
|
{ |
197
|
|
|
if (empty($movie)) { |
198
|
|
|
return false; |
199
|
|
|
} |
200
|
|
|
$this->_response = getRawHtml(self::ADE.$this->_dvdQuery.rawurlencode($movie)); |
201
|
|
|
if ($this->_response !== false) { |
202
|
|
|
if ($res = $this->_html->loadHtml($this->_response)->find('a[class=fancybox-button]')) { |
203
|
|
|
foreach ($res as $ret) { |
204
|
|
|
$title = $ret->title; |
205
|
|
|
$title = str_replace('/XXX/', '', $title); |
206
|
|
|
$title = preg_replace('/\(.*?\)|[-._]/', ' ', $title); |
207
|
|
|
$url = trim($ret->href); |
208
|
|
|
similar_text(strtolower($movie), strtolower($title), $p); |
209
|
|
|
if ($p >= 90) { |
210
|
|
|
$this->_directUrl = self::ADE.$url; |
211
|
|
|
$this->_title = trim($title); |
212
|
|
|
unset($this->_response); |
213
|
|
|
$this->_response = getRawHtml($this->_directUrl); |
214
|
|
|
$this->_html->loadHtml($this->_response); |
|
|
|
|
215
|
|
|
|
216
|
|
|
return true; |
217
|
|
|
} |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
return false; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
return false; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
return false; |
227
|
|
|
} |
228
|
|
|
} |
229
|
|
|
|