fix imdb name link

This commit is contained in:
xiaomlove
2021-01-09 13:18:11 +08:00
parent 9cdd080d06
commit 518d41af9c
2 changed files with 25 additions and 19 deletions

View File

@@ -249,7 +249,7 @@ else {
$temp = "";
for ($i = 0; $i < count ($director); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/Name?" . "".$director[$i]["imdb"]."" ."\">" . $director[$i]["name"] . "</a>, ";
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$director[$i]["imdb"]."" ."\">" . $director[$i]["name"] . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
}
@@ -260,7 +260,7 @@ else {
$temp = "";
for ($i = 0; $i < count ($write); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/Name?" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a>, ";
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
@@ -268,7 +268,7 @@ else {
$temp = "";
for ($i = 0; $i < count ($produce); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/Name?" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a>, ";
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
@@ -276,7 +276,7 @@ else {
$temp = "";
for ($i = 0; $i < count($compose); $i++)
{
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/Name?" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a>, ";
$temp .= "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a>, ";
}
$autodata .= rtrim(trim($temp), ",");
@@ -307,11 +307,11 @@ else {
for ($i = 0; $i < count ($cast); $i++)
{
if ($i > 9)
{
break;
}
$autodata .= "<font color=\"DarkRed\">.</font> " . "<a target=\"_blank\" href=\"https://www.imdb.com/Name?" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
// if ($i > 9)
// {
// break;
// }
$autodata .= "<font color=\"DarkRed\">.</font> " . "<a target=\"_blank\" href=\"https://www.imdb.com/" . "".$cast[$i]["imdb"]."" ."\">" . $cast[$i]["name"] . "</a> " .$lang_details['text_as']."<strong><font color=\"DarkRed\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
}
@@ -357,7 +357,7 @@ else {
print("<td class=\"rowfollow\" align=\"left\"><div id='kimdb'>".$autodata);
$Cache->end_part();
$Cache->add_part();
print($lang_details['text_information_updated_at'] . date("Y-m-d", $cache_time) . $lang_details['text_might_be_outdated']."<a href=\"".htmlspecialchars("retriver.php?id=". $id ."&type=2&siteid=1")."\">".$lang_details['text_here_to_update']);
print($lang_details['text_information_updated_at'] . date("Y-m-d H:i:s", $cache_time) . $lang_details['text_might_be_outdated']."<a href=\"".htmlspecialchars("retriver.php?id=". $id ."&type=2&siteid=1")."\">".$lang_details['text_here_to_update']);
$Cache->end_part();
$Cache->end_row();
$Cache->add_whole_row();

View File

@@ -47,7 +47,7 @@
var $plot_plot = "";
var $taglines = "";
var $credits_cast = "";
var $credits_cast = [];
var $credits_director = [];
var $credits_writing = "";
var $credits_producer = "";
@@ -259,7 +259,7 @@ $responseBody = $response->getBody();
$this->main_plotoutline = "";
$this->main_alttitle = "";
$this->main_colors = "";
$this->credits_cast = "";
$this->credits_cast = [];
$this->main_director = "";
$this->main_creator = "";
@@ -825,10 +825,13 @@ $responseBody = $response->getBody();
*/
function get_imdbname( $href){
if ( strlen( $href) == 0) return $href;
$name_s = 15;
$name_e = strpos ( $href, '"', $name_s);
// $name_s = 15;
$startStr = 'href="/';
$name_s = strpos($href, $startStr);
$name_e = strpos ( $href, '?', $name_s);
if ( $name_e != 0){
return substr( $href, $name_s, $name_e -1 - $name_s);
$result = substr( $href, $name_s, $name_e -1 - $name_s);
return substr($result, strlen($startStr));
}else{
return $href;
}
@@ -843,12 +846,14 @@ $responseBody = $response->getBody();
if ($this->page["Credits"] == "") $this->openpage ("Credits");
}
$director_rows = $this->get_table_rows($this->page["Credits"], "Directed by");
do_log("director_rows: " . json_encode($director_rows));
for ( $i = 0; $i < count ($director_rows); $i++){
$cels = $this->get_row_cels ($director_rows[$i]);
do_log("director cels: " . json_encode($cels));
if (!isset ($cels[0])) return array();
$dir["imdb"] = $this->get_imdbname($cels[0]);
$dir["name"] = strip_tags($cels[0]);
$role = trim(strip_tags($cels[2]));
$role = trim(strip_tags($cels[1]));
if ( $role == ""){
$dir["role"] = NULL;
}else{
@@ -889,13 +894,14 @@ $responseBody = $response->getBody();
// $cast_rows = $this->get_table_rows_cast($this->page["Credits"], "Cast");
$cast_rows = $this->get_table_rows($this->page["Title"], "Cast</h2>");
do_log("cast_rows: " . json_encode($cast_rows));
// dd($cast_rows);
for ( $i = 0; $i < count ($cast_rows); $i++){
$cels = $this->get_row_cels ($cast_rows[$i]);
if (!isset ($cels[0])) return array();
$dir = [];
$dir["imdb"] = $this->get_imdbname($cels[0]);
$dir["name"] = strip_tags($cels[0]);
$role = strip_tags($cels[2]);
$dir["name"] = trim(strip_tags($cels[1]));
$role = trim(strip_tags($cels[3]));
do_log("cast cels: " . json_encode($cels) . ", dir: " . json_encode($dir) . ", role: $role");
if ( $role == ""){
$dir["role"] = NULL;
}else{