1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Blacklight\processing\adult; |
4
|
|
|
|
5
|
|
|
class Hotmovies extends AdultMovies |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Constant Urls used within this class |
9
|
|
|
* Needed Search Queries Variables. |
10
|
|
|
*/ |
11
|
|
|
private const EXTRASEARCH = '&complete=on&search_in=video_title'; |
12
|
|
|
private const HMURL = 'http://www.hotmovies.com'; |
13
|
|
|
private const TRAILINGSEARCH = '/search.php?words='; |
14
|
|
|
/** |
15
|
|
|
* Keyword Search. |
16
|
|
|
* |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
protected $searchTerm = ''; |
20
|
|
|
/** |
21
|
|
|
* Define a cookie location. |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
public $cookie = ''; |
26
|
|
|
/** |
27
|
|
|
* If a direct link is set parse it instead of search for it. |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
protected $directLink = ''; |
32
|
|
|
/** |
33
|
|
|
* Sets the direct url in the getAll method. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $_directUrl = ''; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Sets the link to get in curl. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $_getLink = ''; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* POST parameters used with curl. |
48
|
|
|
* |
49
|
|
|
* @var array |
50
|
|
|
*/ |
51
|
|
|
protected $_postParams = []; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Results return from some methods. |
55
|
|
|
* |
56
|
|
|
* @var array |
57
|
|
|
*/ |
58
|
|
|
protected $_res = []; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Raw Html from Curl. |
62
|
|
|
*/ |
63
|
|
|
protected $_response; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Sets the title in the getAll method. |
67
|
|
|
* |
68
|
|
|
* @var string |
69
|
|
|
*/ |
70
|
|
|
protected $_title = ''; |
71
|
|
|
|
72
|
|
|
protected function trailers() |
73
|
|
|
{ |
74
|
|
|
// TODO: Implement trailers() method. |
75
|
|
|
|
76
|
|
|
return false; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Gets the synopsis. |
81
|
|
|
* |
82
|
|
|
* @return array |
83
|
|
|
*/ |
84
|
|
|
protected function synopsis(): array |
85
|
|
|
{ |
86
|
|
|
$this->_res['synopsis'] = 'N/A'; |
87
|
|
|
if ($this->_html->findOne('.desc_link')) { |
88
|
|
|
$ret = $this->_html->findOne('.video_description'); |
89
|
|
|
if ($ret !== false) { |
|
|
|
|
90
|
|
|
$this->_res['synopsis'] = trim($ret->innerText); |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
return $this->_res; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Process ProductInfo. |
99
|
|
|
* |
100
|
|
|
* @param bool $extras |
101
|
|
|
* |
102
|
|
|
* @return array |
103
|
|
|
*/ |
104
|
|
|
protected function productInfo($extras = false): array |
105
|
|
|
{ |
106
|
|
|
$studio = false; |
107
|
|
|
$director = false; |
108
|
|
|
if ($ret = $this->_html->find('div.page_video_info')) { |
109
|
|
|
foreach ($ret->find('text') as $e) { |
110
|
|
|
$e = trim($e->plaintext); |
111
|
|
|
$rArray = [',', '...', ' :']; |
112
|
|
|
$e = str_replace($rArray, '', $e); |
113
|
|
|
if (stripos($e, 'Studio:') !== false) { |
114
|
|
|
$studio = true; |
115
|
|
|
} |
116
|
|
|
if (strpos($e, 'Director:') !== false) { |
117
|
|
|
$director = true; |
118
|
|
|
$e = null; |
119
|
|
|
} |
120
|
|
|
if ($studio === true) { |
121
|
|
|
if ((stripos($e, 'Custodian of Records') === false) && stripos($e, 'Description') === false) { |
122
|
|
|
if ($director === true && ! empty($e)) { |
123
|
|
|
$this->_res['director'] = $e; |
124
|
|
|
$e = null; |
125
|
|
|
$director = false; |
126
|
|
|
} |
127
|
|
|
if (! empty($e)) { |
128
|
|
|
$this->_res['productinfo'][] = $e; |
129
|
|
|
} |
130
|
|
|
} else { |
131
|
|
|
break; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
if (isset($this->_res['productinfo']) && \is_array($this->_res['productinfo'])) { |
137
|
|
|
$this->_res['productinfo'] = array_chunk($this->_res['productinfo'], 2, false); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
return $this->_res; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Gets the cast members and director. |
145
|
|
|
* |
146
|
|
|
* @return array |
147
|
|
|
*/ |
148
|
|
|
protected function cast() |
149
|
|
|
{ |
150
|
|
|
$cast = []; |
151
|
|
|
if ($this->_html->find('.stars bottom_margin')) { |
152
|
|
|
foreach ($this->_html->find('a[title]') as $e) { |
153
|
|
|
$e = trim($e->title); |
154
|
|
|
$e = preg_replace('/\((.*)\)/', '', $e); |
155
|
|
|
$cast[] = trim($e); |
156
|
|
|
} |
157
|
|
|
$this->_res['cast'] = $cast; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
return $this->_res; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Gets categories. |
165
|
|
|
* |
166
|
|
|
* @return array |
167
|
|
|
*/ |
168
|
|
|
protected function genres() |
169
|
|
|
{ |
170
|
|
|
$genres = []; |
171
|
|
|
if ($ret = $this->_html->findOne('div.categories')) { |
172
|
|
|
foreach ($ret->find('a') as $e) { |
173
|
|
|
if (strpos($e->title, ' -> ') !== false) { |
174
|
|
|
$e = explode(' -> ', $e->plaintext); |
175
|
|
|
$genres[] = trim($e[1]); |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
$this->_res['genres'] = $genres; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
return $this->_res; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Get Box Cover Images. |
186
|
|
|
* |
187
|
|
|
* |
188
|
|
|
* @return array|false|mixed |
189
|
|
|
*/ |
190
|
|
|
protected function covers() |
191
|
|
|
{ |
192
|
|
|
if ($ret = $this->_html->find('div#large_cover, img#cover', 1)) { |
193
|
|
|
$this->_res['boxcover'] = trim($ret->src); |
|
|
|
|
194
|
|
|
$this->_res['backcover'] = str_ireplace('.cover', '.back', trim($ret->src)); |
195
|
|
|
} else { |
196
|
|
|
return false; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
return $this->_res; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Searches for match against xxx movie name. |
204
|
|
|
* |
205
|
|
|
* @param string $movie |
206
|
|
|
* |
207
|
|
|
* @return bool , true if search >= 90% |
208
|
|
|
*/ |
209
|
|
|
public function processSite($movie): bool |
210
|
|
|
{ |
211
|
|
|
if (empty($movie)) { |
212
|
|
|
return false; |
213
|
|
|
} |
214
|
|
|
$this->_response = false; |
215
|
|
|
$this->_getLink = self::HMURL.self::TRAILINGSEARCH.urlencode($movie).self::EXTRASEARCH; |
216
|
|
|
$this->_response = getRawHtml($this->_getLink, $this->cookie); |
217
|
|
|
if ($this->_response !== false) { |
218
|
|
|
if ($ret = $this->_html->loadHtml($this->_response)->findOne('h3[class=title]')) { |
219
|
|
|
if ($ret->findOne('a[title]')) { |
|
|
|
|
220
|
|
|
$ret = $ret->findOne('a[title]'); |
221
|
|
|
$title = trim($ret->title); |
|
|
|
|
222
|
|
|
$title = str_replace('/XXX/', '', $title); |
223
|
|
|
$title = preg_replace('/\(.*?\)|[-._]/', ' ', $title); |
224
|
|
|
if (! empty($title)) { |
225
|
|
|
similar_text($movie, $title, $p); |
226
|
|
|
if ($p >= 90) { |
227
|
|
|
$this->_title = $title; |
228
|
|
|
$this->_getLink = trim($ret->href); |
229
|
|
|
$this->_directUrl = trim($ret->href); |
230
|
|
|
unset($this->_response); |
231
|
|
|
if ($this->_getLink !== false) { |
232
|
|
|
$this->_response = getRawHtml($this->_getLink, $this->cookie); |
233
|
|
|
$this->_html->loadHtml($this->_response); |
|
|
|
|
234
|
|
|
} else { |
235
|
|
|
$this->_response = getRawHtml($this->_directUrl, $this->cookie); |
236
|
|
|
$this->_html->loadHtml($this->_response); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
return true; |
240
|
|
|
} |
241
|
|
|
} |
242
|
|
|
} |
243
|
|
|
} |
244
|
|
|
} else { |
245
|
|
|
return false; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
return false; |
249
|
|
|
} |
250
|
|
|
} |
251
|
|
|
|