This repository was archived by the owner on Jun 17, 2022. It is now read-only.
Description When I am trying to add a new movie and use imdb to look it up, the thumbnail always displays no image available. can you help me solve this issue
'
([^\<]*)',
//'year' => '(([0-9]{4}) )',
//'poster' => ' ',
//'poster' => ' ',
//'poster' => ' ',
//'director' => '#Director.*\n[^<]*([^<]*) #i',
//'genre' => '([a-zA-Z\\-]*) ',
//'rating' => '([0-9]).([0-9])/10 ',
//'cast' => NULL, // The cast is populated in the fetchDeeper() function
//'runtime' => '([0-9]+) min',
//'akas' => 'Also Known As: (.*)MPAA ',
//'country' => ']*)/">([^<]*) ',
//'plot' => 'Plot Outline: ([^\<]*)<'
'title' => '([^<]*)<',
'year' => '(([0-9]{4}) )',
'poster' => ']* />',
'director' => '/
(.*?)<\/div>/s',
'genre' => 'href=\"/genre/[a-zA-Z\\-]*\"[ ]*>([a-zA-Z\\-]*)',
'rating' => '([0-9]).([0-9]) ',
'cast' => NULL, // The cast is populated in the fetchDeeper() function
'runtime' => '([0-9]+) min',
'akas' => '#]+>Also Known As: \s*(.*)#',
'country' => 'href=\"/country/([^>]*)"[ ]*>([^<]*)',
'plot' => '#Storyline \s*(.*)\s*
#'
);
protected $multiArray = array(
'genre', 'cast', 'akas', 'country'
);
private $servername = 'akas.imdb.com';
private $searchpath = '/find?s=tt&q=[$ ]';
private $itempath = '/title/tt[$ ]/';
public function __construct() {
$this->setSiteName("imdb");
$this->setFetchUrls($this->servername, $this->searchpath, $this->itempath);
$this->useSnoopy();
}
public function search($title) {
return parent::search($title);
}
public function showSearchResults() {
$this->setMaxSearchResults(50);
$regx = '([^\<]*) [^(]*\(([0-9]{4}(/I+)?)\)';
$results = parent::generateSimpleSearchResults($regx, 1, 3, 4);
return parent::generateSearchSelection($results);
}
protected function processResults() {
if (!is_array($this->workerArray) || sizeof($this->workerArray) == 0) {
$this->setErrorMsg("No results to process.");
return;
}
$obj = new imdbObj();
$obj->setIMDB($this->getItemID());
foreach ($this->workerArray as $key => $data) {
$entry = $data[0];
$arrData = $data[1];
switch ($entry) {
case 'title':
$title = $arrData[1];
$obj->setTitle($title);
break;
case 'year':
$year = $arrData[2];
$obj->setYear($year);
break;
case 'poster':
$poster = $arrData[4];
$obj->setImage($poster);
break;
case 'director':
$director = $arrData[1];
$obj->setDirector($director);
break;
case 'genre':
$arr = array();
foreach ($arrData as $item) {
array_push($arr, $item[1]);
}
$obj->setGenre($arr);
break;
case 'rating':
$rating = $arrData[1].$arrData[2];
$rating = $rating/10;
$obj->setRating($rating);
break;
case 'cast':
// The cast list has been populated in the fetchDeeper function
if (is_array($arrData)) {
$obj->setCast($arrData);
}
break;
case 'runtime':
$runtime = $arrData[1];
$obj->setRuntime($runtime);
break;
case 'akas':
$akaTitles = implode(',', $arrData);
$obj->setAltTitle($akaTitles);
break;
case 'plot':
if (is_array($arrData)) {
$plot = trim($arrData[1]);
} elseif (is_string($arrData)) {
$plot = trim($arrData);
}
$obj->setPlot($plot);
break;
case 'country':
if (sizeof($arrData) > 0) {
$arrCountries = array();
foreach ($arrData as $itemArr) {
array_push($arrCountries, $itemArr[2]);
}
$obj->setCountry($arrCountries);
}
break;
default:
break;
}
}
$this->fetchedObj = $obj;
}
protected function fetchDeeper($entry) {
switch ($entry) {
case 'cast':
$regx = '/([^<]*)<\/a><\/td> ... <\/td>(.*?)<\/td>/';
preg_match_all($regx, $this->getContents(), $matches);
if (is_array($matches) && sizeof($matches)>0) {
$actors = $matches[2];
$roles = $matches[3];
$castList = array();
for($i=0;$iworkerArray, array($entry, $castList));
}
break;
case 'poster':
$regx = ' ';
if ($this->getItem($regx) == self::ITEM_OK) {
$res = $this->getFetchedItem();
}
break;
case 'akas':
$ret = array();
$contents = $this->getContents();
if(eregi('Also Known As: (.*)MPAA ',$contents, $y)) {
$contents = $y[0];
while(eregi(' ([^<]*)', $contents, $x)) {
if (isset($x[1]) && strcmp(trim($x[1]),"") != 0) {
$ret[] = trim($x[1]);
}
$contents = substr($contents,strpos($contents,$x[0])+strlen($x[0]));
}
}
array_push($this->workerArray, array($entry, $ret));
break;
case 'plot':
// Save the old buffer
$itemBuffer = $this->getContents();
// Generate urls
$plotUrl = str_replace('[$]', $this->getItemID(), $this->itempath).'plotsummary';
$referer = "http://".$this->servername.str_replace('[$]', $this->getItemID(), $this->itempath);
$isPlot = $this->fetchPage($this->servername, $plotUrl, $referer);
if ($isPlot) {
$regxPlot = '([^\<]*)';
if ($this->getItem($regxPlot) == self::ITEM_OK) {
$plotArr = $this->getFetchedItem();
$plotText = trim($plotArr[1]);
array_push($this->workerArray, array($entry, $plotText));
} else {
// Plot not found, use the Tagline instead and use the old buffer again
$regExTagline = '#Tagline: ([^<]*)#';
$this->setContents($itemBuffer);
if ($this->getItem($regExTagline) == self::ITEM_OK ) {
$plotArr = $this->getFetchedItem();
$plotText = $plotArr[1];
array_push($this->workerArray, array($entry, $plotText));
}
}
}
break;
default:
break;
}
}
```
}
?>
Reactions are currently unavailable
When I am trying to add a new movie and use imdb to look it up, the thumbnail always displays no image available. can you help me solve this issue
'([^\<]*)', //'year' => '(([0-9]{4}))', //'poster' => '', //'poster' => '', //'poster' => '', //'director' => '#Director.*\n[^<]*([^<]*)#i', //'genre' => '([a-zA-Z\\-]*)', //'rating' => '([0-9]).([0-9])/10', //'cast' => NULL, // The cast is populated in the fetchDeeper() function //'runtime' => '([0-9]+) min', //'akas' => 'Also Known As:$searchpath = '/find?s=tt&q=[$ ]';
private $itempath = '/title/tt[$ ]/';
public function __construct() {
$this->setSiteName("imdb");
$this->setFetchUrls($this->servername, $this->searchpath, $this->itempath);
$this->useSnoopy();
}
public function search($title) {
return parent::search($title);
}
public function showSearchResults() {
$this->setMaxSearchResults(50);
$regx = '([^\<]*)[^(]*\(([0-9]{4}(/I+)?)\)';
$results = parent::generateSimpleSearchResults($regx, 1, 3, 4);
return parent::generateSearchSelection($results);
}
protected function processResults() {
if (!is_array($this->workerArray) || sizeof($this->workerArray) == 0) {
$this->setErrorMsg("No results to process.");
return;
}
$obj = new imdbObj();
$obj->setIMDB($this->getItemID());
foreach ($this->workerArray as $key => $data) {
$entry = $data[0];
$arrData = $data[1];
switch ($entry) {
case 'title':
$title = $arrData[1];
$obj->setTitle($title);
break;
case 'year':
$year = $arrData[2];
$obj->setYear($year);
break;
case 'poster':
$poster = $arrData[4];
$obj->setImage($poster);
break;
case 'director':
$director = $arrData[1];
$obj->setDirector($director);
break;
case 'genre':
$arr = array();
foreach ($arrData as $item) {
array_push($arr, $item[1]);
}
$obj->setGenre($arr);
break;
case 'rating':
$rating = $arrData[1].$arrData[2];
$rating = $rating/10;
$obj->setRating($rating);
break;
case 'cast':
// The cast list has been populated in the fetchDeeper function
if (is_array($arrData)) {
$obj->setCast($arrData);
}
break;
case 'runtime':
$runtime = $arrData[1];
$obj->setRuntime($runtime);
break;
case 'akas':
$akaTitles = implode(',', $arrData);
$obj->setAltTitle($akaTitles);
break;
case 'plot':
if (is_array($arrData)) {
$plot = trim($arrData[1]);
} elseif (is_string($arrData)) {
$plot = trim($arrData);
}
$obj->setPlot($plot);
break;
case 'country':
if (sizeof($arrData) > 0) {
$arrCountries = array();
foreach ($arrData as $itemArr) {
array_push($arrCountries, $itemArr[2]);
}
$obj->setCountry($arrCountries);
}
break;
default:
break;
}
}
$this->fetchedObj = $obj;
}
protected function fetchDeeper($entry) {
switch ($entry) {
case 'cast':
$regx = '/([^<]*)<\/a><\/td> ... <\/td>(.*?)<\/td>/';
preg_match_all($regx, $this->getContents(), $matches);
if (is_array($matches) && sizeof($matches)>0) {
$actors = $matches[2];
$roles = $matches[3];
$castList = array();
for($i=0;$iworkerArray, array($entry, $castList));
}
break;
case 'poster':
$regx = '
';
if ($this->getItem($regx) == self::ITEM_OK) {
$res = $this->getFetchedItem();
}
break;
case 'akas':
$ret = array();
$contents = $this->getContents();
if(eregi('Also Known As:
(.*)MPAA', //'country' => ']*)/">([^<]*)', //'plot' => '
Plot Outline:
([^\<]*)<' 'title' => '([^<]*)<', 'year' => '(([0-9]{4}))', 'poster' => ']* />', 'director' => '/
(.*?)<\/div>/s', 'genre' => 'href=\"/genre/[a-zA-Z\\-]*\"[ ]*>([a-zA-Z\\-]*)', 'rating' => '([0-9]).([0-9])', 'cast' => NULL, // The cast is populated in the fetchDeeper() function 'runtime' => '([0-9]+) min', 'akas' => '#]+>Also Known As:
\s*(.*)#', 'country' => 'href=\"/country/([^>]*)"[ ]*>([^<]*)', 'plot' => '#Storyline
\s*(.*)\s*
#' ); protected $multiArray = array( 'genre', 'cast', 'akas', 'country' ); private $servername = 'akas.imdb.com'; private(.*)MPAA',$contents, $y)) { $contents = $y[0]; while(eregi('
([^<]*)', $contents, $x)) { if (isset($x[1]) && strcmp(trim($x[1]),"") != 0) { $ret[] = trim($x[1]); } $contents = substr($contents,strpos($contents,$x[0])+strlen($x[0])); } } array_push($this->workerArray, array($entry, $ret)); break; case 'plot': // Save the old buffer $itemBuffer = $this->getContents(); // Generate urls $plotUrl = str_replace('[$]', $this->getItemID(), $this->itempath).'plotsummary'; $referer = "http://".$this->servername.str_replace('[$]', $this->getItemID(), $this->itempath); $isPlot = $this->fetchPage($this->servername, $plotUrl, $referer); if ($isPlot) { $regxPlot = '
([^\<]*)'; if ($this->getItem($regxPlot) == self::ITEM_OK) { $plotArr = $this->getFetchedItem(); $plotText = trim($plotArr[1]); array_push($this->workerArray, array($entry, $plotText)); } else { // Plot not found, use the Tagline instead and use the old buffer again $regExTagline = '#Tagline:([^<]*)#'; $this->setContents($itemBuffer); if ($this->getItem($regExTagline) == self::ITEM_OK ) { $plotArr = $this->getFetchedItem(); $plotText = $plotArr[1]; array_push($this->workerArray, array($entry, $plotText)); } } } break; default: break; } } ``` } ?>