diff --git a/imdb/imdb.class.php b/imdb/imdb.class.php index c9800b59..70d682d5 100644 --- a/imdb/imdb.class.php +++ b/imdb/imdb.class.php @@ -359,12 +359,9 @@ $responseBody = $response->getBody(); if ($this->page["Title"] == "") { $this->openpage ("Title"); } - $this->main_title = strstr ($this->page["Title"], ""); - $endpos = strpos ($this->main_title, ""); - $this->main_title = substr ($this->main_title, 7, $endpos - 7); - $year_s = strpos ($this->main_title, "(", 0); - $year_e = strpos ($this->main_title, ")", 0); - $this->main_title = substr ($this->main_title, 0, $year_s - 1); + $result = $this->retrieveFromPage('', ''); + $result = strstr($result, '(', true); + $this->main_title = trim($result); } return $this->main_title; } @@ -378,12 +375,12 @@ $responseBody = $response->getBody(); if ($this->page["Title"] == "") { $this->openpage ("Title"); } - $this->main_year = strstr ($this->page["Title"], ""); - $endpos = strpos ($this->main_title, ""); - $this->main_year = substr ($this->main_year, 7, $endpos - 7); - $year_s = strpos ($this->main_year, "(", 0); - $year_e = strpos ($this->main_year, ")", 0); - $this->main_year = substr ($this->main_year, $year_s + 1, $year_e - $year_s - 1); + $result = $this->retrieveFromPage('', ''); + $begin = mb_strpos($result, '(', 0, 'utf-8'); + $end = mb_strpos($result, ')', $begin, 'utf-8'); + do_log("year, result: $result, begin: $begin, end: $end"); + $result = mb_substr($result, $begin + 1, $end - $begin - 1, 'utf-8'); + $this->main_year = trim($result); } return $this->main_year; } @@ -650,7 +647,9 @@ $responseBody = $response->getBody(); function tagline () { if ($this->main_tagline == "") { $result = $this->retrieveFromPage('Taglines:', ''); - $result = strstr($result, 'main_tagline = $result; @@ -977,19 +976,20 @@ $responseBody = $response->getBody(); } $this->credits_composer = array(); $composer_rows = $this->get_table_rows($this->page["Credits"], "Music by"); + do_log("composer_rows: " . json_encode($composer_rows)); for ( $i = 0; $i < count ($composer_rows); $i++){ $cels = $this->get_row_cels ($composer_rows[$i]); - if ( count ( $cels) > 2){ +// if ( count ( $cels) > 2){ $wrt["imdb"] = $this->get_imdbname($cels[0]); $wrt["name"] = strip_tags($cels[0]); - $role = strip_tags($cels[2]); - if ( $role == ""){ - $wrt["role"] = NULL; - }else{ - $wrt["role"] = $role; - } +// $role = strip_tags($cels[2]); +// if ( $role == ""){ +// $wrt["role"] = NULL; +// }else{ +// $wrt["role"] = $role; +// } $this->credits_composer[$i] = $wrt; - } +// } } return $this->credits_composer; }