diff --git a/Blacklight/processing/adult/ADE.php b/Blacklight/processing/adult/ADE.php index 08b18e58e..963cb8898 100755 --- a/Blacklight/processing/adult/ADE.php +++ b/Blacklight/processing/adult/ADE.php @@ -66,16 +66,14 @@ class ADE extends AdultMovies '#(?:streamID:\s\")(?P[0-9A-Z]+)(?:\")#', $this->_response, $hits - ) - ) { + )) { $this->_res['trailers']['streamid'] = trim($hits['streamid']); } if (preg_match( - '#(?:BaseStreamingUrl:\s\")(?P[\d]+.[\d]+.[\d]+.[\d]+)(?:\")#', + '#(?:BaseStreamingUrl:\s\")(?P[\d]+\.[\d]+\.[\d]+\.[\d]+)(?:\")#', $this->_response, $hits - ) - ) { + )) { $this->_res['trailers']['baseurl'] = $hits['baseurl']; } } @@ -105,9 +103,13 @@ class ADE extends AdultMovies */ protected function synopsis(): array { - $ret = $this->_html->findOne('meta[name=og:description]')->content; - if ($ret !== false) { - $this->_res['synopsis'] = trim($ret); + // Prefer OpenGraph description, fall back to standard meta description + $meta = $this->_html->findOne('meta[property=og:description]'); + if (! $meta) { + $meta = $this->_html->findOne('meta[name=description]'); + } + if ($meta && isset($meta->content) && $meta->content !== false) { + $this->_res['synopsis'] = trim($meta->content); } return $this->_res; diff --git a/Blacklight/processing/adult/AEBN.php b/Blacklight/processing/adult/AEBN.php index 87ce3c837..6e51ceb67 100755 --- a/Blacklight/processing/adult/AEBN.php +++ b/Blacklight/processing/adult/AEBN.php @@ -109,22 +109,26 @@ class AEBN extends AdultMovies */ protected function cast(): array { - $this->_res = []; + // Do not reset the whole results array; only populate the cast key. + $cast = []; $ret = $this->_html->findOne('div.starsFull'); if (! $ret instanceof SimpleHtmlDomNodeBlank) { foreach ($ret->find('span[itemprop=name]') as $star) { - $this->_res['cast'][] = trim($star->plaintext); + $cast[] = trim($star->plaintext); } } else { $ret = $this->_html->findOne('div.detailsLink'); if (! $ret instanceof SimpleHtmlDomNodeBlank) { foreach ($ret->find('span') as $star) { if (str_contains($star->plaintext, '/More/') && str_contains($star->plaintext, '/Stars/')) { - $this->_res['cast'][] = trim($star->plaintext); + $cast[] = trim($star->plaintext); } } } } + if (! empty($cast)) { + $this->_res['cast'] = $cast; + } return $this->_res; } @@ -160,14 +164,19 @@ class AEBN extends AdultMovies */ protected function synopsis(): array { - if ($ret = $this->_html->findOne('span[itemprop=about]')) { - if ($ret === null) { - if ($ret = $this->_html->findOne('div.movieDetailDescription')) { - $this->_res['synopsis'] = preg_replace('/Description:\s/', '', $this->_res['plot']); - } - } else { - $this->_res['synopsis'] = trim($ret->plaintext); - } + // Prefer the modern schema attribute + $ret = $this->_html->findOne('span[itemprop=about]'); + if ($ret && $ret->plaintext !== null) { + $this->_res['synopsis'] = trim($ret->plaintext); + + return $this->_res; + } + + // Fallback to legacy description container + $ret = $this->_html->findOne('div.movieDetailDescription'); + if ($ret && $ret->plaintext !== null) { + $text = trim($ret->plaintext); + $this->_res['synopsis'] = preg_replace('/^Description:\s*/', '', $text); } return $this->_res; diff --git a/Blacklight/processing/adult/AdultMovies.php b/Blacklight/processing/adult/AdultMovies.php index 8a0b1a481..fd7d2fe1b 100644 --- a/Blacklight/processing/adult/AdultMovies.php +++ b/Blacklight/processing/adult/AdultMovies.php @@ -45,8 +45,12 @@ abstract class AdultMovies public function getAll(): bool|array { $results = []; - if ($this->_directUrl !== null) { - $results['title'] = $this->_title; + + // Only include when present + if (! empty($this->_directUrl)) { + if (! empty($this->_title)) { + $results['title'] = $this->_title; + } $results['directurl'] = $this->_directUrl; } diff --git a/Blacklight/processing/adult/Hotmovies.php b/Blacklight/processing/adult/Hotmovies.php index 3a3eb80d5..2f114c000 100755 --- a/Blacklight/processing/adult/Hotmovies.php +++ b/Blacklight/processing/adult/Hotmovies.php @@ -130,13 +130,31 @@ class Hotmovies extends AdultMovies protected function cast(): array { $cast = []; - if ($this->_html->find('.stars bottom_margin')) { - foreach ($this->_html->find('a[title]') as $e) { - $e = trim($e->title); - $e = preg_replace('/\((.*)\)/', '', $e); - $cast[] = trim($e); + + // Prefer scoped search within stars container to avoid unrelated links + if ($container = $this->_html->findOne('.stars')) { + foreach ($container->find('a[title]') as $e) { + $name = trim($e->title); + $name = preg_replace('/\((.*)\)/', '', $name); + $name = trim($name); + if ($name !== '') { + $cast[] = $name; + } } - $this->_res['cast'] = $cast; + } + + // Fallback: anchors that look like performer links + if (empty($cast)) { + foreach ($this->_html->find('a[href*="/performers/"]') as $e) { + $name = trim($e->plaintext); + if ($name !== '') { + $cast[] = $name; + } + } + } + + if (! empty($cast)) { + $this->_res['cast'] = array_values(array_unique($cast)); } return $this->_res; diff --git a/Blacklight/processing/adult/Popporn.php b/Blacklight/processing/adult/Popporn.php index 4fac595d3..b1acd80f0 100755 --- a/Blacklight/processing/adult/Popporn.php +++ b/Blacklight/processing/adult/Popporn.php @@ -115,7 +115,7 @@ class Popporn extends AdultMovies { // Method 1: Try structured data if (preg_match('/"description":\s*"(.*?)"/is', $this->_response, $match)) { - $this->_res['synopsis'] = trim(html_entity_decode(str_replace('\u', '\\u', $match[1]))); + $this->_res['synopsis'] = trim(html_entity_decode(str_replace('\\u', '\\u', $match[1]))); return $this->_res; } @@ -193,10 +193,11 @@ class Popporn extends AdultMovies // Method 3: Original flash-based trailer extraction if ($ret = $this->_html->findOne('input#thickbox-trailer-link')) { - $ret->value = trim($ret->value); - $ret->value = str_replace('..', '', $ret->value); + $val = \property_exists($ret, 'value') ? (string) $ret->value : ''; + $val = trim($val); + $val = str_replace('..', '', $val); $tmprsp = $this->_response; - $this->_trailUrl = $ret->value; + $this->_trailUrl = $val; if (preg_match_all('/productID="\+(?\d+),/', $this->_response, $hits)) { $productid = $hits['id'][0]; $random = ((float) mt_rand() / (float) mt_getrandmax()) * 5400000000000000; @@ -204,12 +205,12 @@ class Popporn extends AdultMovies $this->_postParams = 'method=pipeStreamLoc&productID='.$productid; $response = getRawHtml(self::BASE_URL.$this->_trailUrl, $this->cookie, $this->_postParams); if (! empty($response)) { - $ret = json_decode(json_decode($response, true), true); - if ($ret && isset($ret['LOC'])) { + $retJson = json_decode(json_decode($response, true), true); + if ($retJson && isset($retJson['LOC'])) { $this->_res['trailers']['baseurl'] = self::BASE_URL.'/flashmediaserver/trailerPlayer.swf'; - $this->_res['trailers']['flashvars'] = 'subscribe=false&image=&file='.self::BASE_URL.'/'.$ret['LOC'].'&autostart=false'; + $this->_res['trailers']['flashvars'] = 'subscribe=false&image=&file='.self::BASE_URL.'/'.$retJson['LOC'].'&autostart=false'; // Also provide a modern URL if possible - $this->_res['trailers']['url'] = self::BASE_URL.'/'.$ret['LOC']; + $this->_res['trailers']['url'] = self::BASE_URL.'/'.$retJson['LOC']; } } $this->_response = $tmprsp;