Wie Apple CMS das Douban-Bewertungsproblem löst

Douban-Bewertungen sind im Apple CMS-Backend ungültig und Douban-Bewertungen und zugehörige Informationen können nicht abgerufen werden

Es handelt sich um ein seltenes Film- und Fernseh-CMS, das problemlos eineDie Website wurde aufgrund zahlreicher Urheberrechtsstreitigkeiten nicht von Apple CMS aktualisiert und gepflegt. Sie befindet sich derzeit in einem Zustand ohne Wartung. Der Programmhintergrund erhält automatischAufgrund der Aktualisierung der Douban-API kann die Funktion keine Bewertungen und Informationen abrufen. Wir lösen dieses Problem.

Manuelle Abfrage von Douban-Bewertungen und Videodaten

Unten finden Sie den Quellcode der API-Schnittstelle zur Erfassung von Douban-Bewertungsinformationen in Apple CMS v10. Kopieren und speichern Sie den PHP-Quellcode als douban.php

Laden Sie dann douban.php in das Stammverzeichnis der Website hoch.

 ","
", $data); if($txt3==''){ $vod_pic = str_substr('"image": "','",', $data); $vod_score=str_substr('','', $data); //评分 $vod_reurl=str_substr('data-url="','"', $data); //豆瓣地址 $a_name=str_substr('','', $data); if(baohan($a_name,'剧情简介')=='1'){ $d_name=str_substr('
','的剧情简介', '
'.$a_name); }elseif(baohan($a_name,'的分集短评')=='1'){ $d_name=str_substr('
','的分集', '
'.$a_name); }elseif(baohan($a_name,'的演职员')=='1'){ $d_name=str_substr('
','的演职员', '
'.$a_name); }elseif(baohan($a_name,'的图片')=='1'){ $d_name=str_substr('
','的图片', '
'.$a_name); }elseif(baohan($a_name,'的短评')=='1'){ $d_name=str_substr('
','的短评', '
'.$a_name); }elseif(baohan($a_name,'的影评')=='1'){ $d_name=str_substr('
','的影评', '
'.$a_name); } $a_name=str_substr('','', $data); $vod_year=str_substr('(',')', $data); //年代 $txt1 = str_substr("导演: ","
", $data); $vod_director=preg_replace("/]*>(.*)<\/a>/isU",'${1}',$txt1); //导演 $txt = str_substr("主演: ","
", $data); $d_starring=preg_replace("/]*>(.*)<\/a>/isU",'${1}',$txt); $vod_actor=str_replace("'",',',$d_starring); //主演 $txt5 = str_substr("编剧: ","
", $data); $vod_writer=preg_replace("/]*>(.*)<\/a>/isU",'${1}',$txt5); //编辑 $txt2 = str_substr("类型: ","
", $data); $vod_class=preg_replace("/]*>(.*)<\/span>/isU",'${1}',$txt2); //分类 $vod_area = str_substr("制片国家/地区: ","
", $data); //地区 $vod_lang = str_substr("语言: ","
", $data); //语言 $d_subname=str_substr("又名: ","
", $data); $vod_sub=str_replace("'","'",$d_subname); //别名 $txt3 = str_substr("上映日期: ","
", $data); $vod_pubdate=preg_replace("/]*>(.*)<\/span>/isU",'${1}',$txt3); //上映日期 $vod_duration=str_substr('片长: ', $data); //片长 $d_content=str_substr('','', $data); if($d_content==''){ $d_content=str_substr('', $data); } $vod_content=str_replace("'","'",$d_content); //简介 $vod_total=''; //集数 if(strstr($vod_area,"中国")==true){ $vod_remarks='高清国语'; }elseif(strstr($vod_area,"台湾")==true){ $vod_remarks='高清国语'; }else{ $vod_remarks='高清中字'; } }else{ $vod_pic = str_substr('"image": "','",', $data); $vod_score=str_substr('','', $data); //评分 $vod_reurl=str_substr('data-url="','"', $data); //豆瓣地址 $a_name=str_substr('','', $data); if(baohan($a_name,'剧情简介')=='1'){ $d_name=str_substr('
','的剧情简介', '
'.$a_name); }elseif(baohan($a_name,'的分集短评')=='1'){ $d_name=str_substr('
','的分集', '
'.$a_name); }elseif(baohan($a_name,'的演职员')=='1'){ $d_name=str_substr('
','的演职员', '
'.$a_name); }elseif(baohan($a_name,'的图片')=='1'){ $d_name=str_substr('
','的图片', '
'.$a_name); }elseif(baohan($a_name,'的短评')=='1'){ $d_name=str_substr('
','的短评', '
'.$a_name); }elseif(baohan($a_name,'的影评')=='1'){ $d_name=str_substr('
','的影评', '
'.$a_name); } $a_name=str_substr('','', $data); $vod_year=str_substr('(',')', $data); //年代 $txt1 = str_substr("导演: ","
", $data); $vod_director=preg_replace("/]*>(.*)<\/a>/isU",'${1}',$txt1); //导演 $txt = str_substr("主演: ","
", $data); $vod_actor=preg_replace("/]*>(.*)<\/a>/isU",'${1}',$txt); //主演 $txt5 = str_substr("编剧: ","
", $data); $vod_writer=preg_replace("/]*>(.*)<\/a>/isU",'${1}',$txt5); //编辑 $txt2 = str_substr("类型: ","
", $data); $vod_class=preg_replace("/]*>(.*)<\/span>/isU",'${1}',$txt2); //分类 $vod_area = str_substr("制片国家/地区: ","
", $data); //国家 $vod_lang = str_substr("语言: ","
", $data); //语言 $d_subname=str_substr("又名: ","
", $data); $vod_sub=str_replace("'","'",$d_subname); //别名 $txt3 = str_substr("首播: ","
", $data); $vod_pubdate=preg_replace("/]*>(.*)<\/span>/isU",'${1}',$txt3); //上映日期 $vod_duration=str_substr('单集片长: ','
', $data); //片长 $vod_duration=str_replace("分钟","",$vod_duration); $d_content=str_substr('','', $data); if($d_content==''){ $d_content=str_substr('', $data); } $vod_content=str_replace("'","'",$d_content); //简介 $vod_total=str_substr('集数: ','
', $data); //集数 $vod_remarks='总集数'.$vod_total; } if($vod_sub==''){ $vod_sub=$a_name.$vod_year; } if($vod_year==''){ $vod_year='内详'; } if($vod_score==''){ $vod_score=rand(1,4).'.'.rand(0,9); } if($vod_director==''){ $vod_director='内详'; } if($vod_actor==''){ $vod_actor='内详'; } if($vod_content==''){ $vod_content='内详'; } if($d_name==''){ $vurl='({"code":102,"auth":"豆瓣评分","msg":"资料采集失败"});'; }else{ $info['vod_name'] = $d_name; $info['vod_sub'] = $vod_sub.','.$a_name; $info['vod_pic'] = $vod_pic; $info['vod_year'] = $vod_year; $info['vod_lang'] = $vod_lang; $info['vod_area'] = $vod_area; $info['vod_remarks'] = $vod_remarks; $info['vod_total'] = $vod_total; $info['vod_serial'] = ''; $info['vod_isend'] = 1; $info['vod_class'] = $vod_class; $info['vod_tag'] = ''; $info['vod_actor'] = $vod_actor; $info['vod_director'] = $vod_director; $info['vod_pubdate'] = $vod_pubdate; $info['vod_writer'] = $vod_writer; $info['vod_score'] = $vod_score; $info['vod_score_num'] = rand(100,1000); $info['vod_score_all'] = rand(200,500); $info['vod_douban_score'] = $vod_score; $info['vod_duration'] = strip_tags($vod_duration); $info['vod_reurl'] = $vod_reurl; $info['vod_author'] = $vod_author; $info['vod_content'] = cutstr_html($vod_content); $info['vod_douban_id'] = $id; $vurl='({"code":1,"auth":"豆瓣评分","msg":"资料采集成功","data":'.json_encode($info).'});'; } // file_put_contents($file,$vurl); } echo $callback.$vurl; }else{ echo $callback.'({"code":102,"auth":"豆瓣评分","msg":"资料采集失败"});'; } function baohan($str,$needle){ $tmparray = explode($needle,$str); if(count($tmparray)>1){ $yyy='1'; }else{ $yyy='2'; } return $yyy; } function tugeturl($url){ if(function_exists('curl_init')){ $ch = curl_init(); $timeout = 30; curl_setopt ($ch,CURLOPT_URL,$url); curl_setopt ($ch,CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查 curl_setopt ($ch,CURLOPT_SSL_VERIFYHOST, true); curl_setopt ($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt ($ch,CURLOPT_REFERER, $url); curl_setopt ($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $handles = curl_exec($ch); curl_close($ch); }else{ $handles = @file_get_contents($url); } return $handles; } function geturl($url){ if(function_exists('curl_init')){ $ch = curl_init(); $timeout = 30; curl_setopt ($ch,CURLOPT_URL,$url); curl_setopt ($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt ($ch,CURLOPT_REFERER, $url); curl_setopt ($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $handles = curl_exec($ch); curl_close($ch); }else{ $handles = @file_get_contents($url); } return $handles; } function getvrl($url){ $vurl = str_replace(array('"',"'"),array("'","‘"),$url); return $vurl; } function cutstr_html($string){ $string = strip_tags($string); $string = trim($string); $string = str_replace("\t","",$string); $string = str_replace("\r\n","",$string); $string = str_replace("\r","",$string); $string = str_replace("\n","",$string); $string = str_replace(" ","",$string); $string = str_replace(" ","",$string); return trim($string); } function str_substr($start, $end, $str){ $temp = explode($start, $str, 2); $content = explode($end, $temp[1], 2); return $content[0]; } ?>

Öffnen Sie dann die Datei /application/admin/view/vod/info.html der Website per FTP.

suchen:URL: '

Linie 719

Zeitüberschreitung: 5000, URL: „//“ + „API“ + „.“ + „Mac“ + „CMS“ + „.“ + „la“ + „/douban/index/id/“ + ID,

Ersetzen Sie die beiden obigen Zeilen durch:

Zeitüberschreitung: 10000, URL: 'https://IhreDomain/douban.php?id=' + ID,

Wie löst Apple CMS das Problem ungültiger Douban-Bewertungen? -1

Nachdem Sie nun auf die Abfrage der Daten geklickt haben, können Sie erfolgreich Douban-Bewertungen und zugehörige Inhalte abrufen.

Um zu testen, ob die Datei douban.php Daten zurückgibt, fügen Sie nach der Datei ?id=36151692 hinzu, wobei die Nummer die Douban-ID ist.

https://Ihr Domänenname/douban.php?id=36151692

({"code":1,"auth":"Douban Rating","msg":"Datenerfassung erfolgreich","data":{"vod_name":"\u5468\u5904\u9664\u4e09\u5bb3","vod_sub":"Das Schwein, die Schlange und die Taube,\u5468\u5904\u9664\u4e09\u5bb3 \u5468\u8655\u9664\u4e09\u5bb3","vod_pic":"https:\/\/img3.doubanio.com\/view\/photo\/s_ratio_poster\/public\/p2905021483.jpg","vod_year":"2023" ,"vod_lang":"\u6c49\u8bed\u666e\u901a\u8bdd,\u95fd\u5357\u8bed,\u7ca4\u8 bed","vod_area":"\u4e2d\u56fd\u53f0\u6e7e","vod_remarks":"\u9ad8\u6e05\u 56fd\u8bed","vod_total":"","vod_serial":"","vod_isend":1,"vod_class":"\u52a8\u4f5c,\u72af\u7f6a","vod_tag":"","vod_actor":"\u962e\u7ecf\u5929,\ u8881\u5bcc\u534e,\u9648\u4ee5\u6587,\u738b\u51c0,\u8c22\u743c\u7156,\u6 74e\u674e\u4ec1,\u5218\u5b50\u94e8,\u66fe\u73ee\u745c,\u9648\u79c9\u4f51 ,\u6e38\u5b89\u987a,\u90d1\u6709\u6770,\u76db\u9274,\u5434\u5955\u84c9,\u9ec 4\u8fea\u626c,\u66fe\u5411\u9547,\u6c88\u5a01\u5e74,\u6768\u8fe6\u6069,\u66f e\u7693\u6cfd,\u90d1\u6c38\u5cb3,\u5f20\u542f\u4e50,\u82cf\u8000\u5ead,\u7ec 3\u5bb6\u8c6a,\u674e\u660e\u54f2,\u5ed6\u5a01\u8fea,\u7f57\u632f\u4f51,\u738 b\u53c8\u6b63,\u6797\u541\u67d4,\u9ec4\u701a\u5fb7,\u5218\u5b50\u670b,\u7f5 7\u80fd\u534e,\u8bb8\u8389\u5ef7,\u6797\u745e\u534e,\u5218\u79be\80b2,\u90e d\u5bb9\u817e,\u674e\u5e74\u96c4,\u8bb8\u5fb7\u57ce,\u9ec4\u60e0\u537f,\u521 8\u6615\u660a","vod_director":"\u9ec4\u7cbe\u752b","vod_pubdate":"2024-03-01( \u4e2d\u56fd\u5927\u9646),2023-10-06(\u4e2d\u56fd\u53f0\u6e7e)","vod_writer" :"\u9ec4\u7cbe\u752b","vod_score":"8.1","vod_score_num":354,"vod_score_all": 331,"vod_douban_score":"8.1","vod_duration":"134","vod_reurl":"https:\/\/movie.douban.com\/subject\/36151692\/","vod_author":null,"vod_content":"\u901a\u 7f09\u72af\u9648\u6842\u6797\uff08\u962e\u7ecf\u5929\u9970\uff09\u5728\u9003 \u4ea1\u85cf\u533f\u4e2d\u5931\u53bb\u6700\u540e\u4e00\u4e2a\u4eb2\u4eba\uff 0c\u540c\u65f6\u5f97\u77e5\u81ea\u5df1\u53ea\u6709\u4e0d\u5230\u4e09\u4e2a\u 6708\u7684\u751f\u547d\u3002\u4e07\u5ff5\u4ff1\u7070\u7684\u4ed6\u539f\u6253\ u7b97\u6295\u6848\u81ea\u9996\uff0c\u53ef\u662f\u5f53\u53d1\u73b0\u4ed6\u572 8\u4e09\u5927\u901a\u7f09\u72af\u4e2d\u4ec5\u4ec5\u6392\u540d\u7b2c\u4e09\u6 5f6\uff0c\u5185\u5fc3\u7a81\u7136\u8e81\u52a8\u8d77\u6765\u3002\u5728\u6b64\ u4e4b\u540e\uff0c\u4ed6\u51b3\u5b9a\u4eff\u6548\u53e4\u65f6\u5019\u5468\u590 4\u9664\u4e09\u5bb3\u7684\u6545\u4e8b\uff0c\u4e34\u7ec8\u4e4b\u9645\u8981\u5 728\u6c5f\u6e56\u4e0a\u7559\u4e0b\u4ed6\u7684\u4f20\u5947\u540d\u53f7\u3002\ u901a\u8fc7\u5730\u4e0b\533\u751f\u5f20\u8d35\u537f\uff08\u8c22\u743c\u715 6\u9970\uff09\uff0c\u9648\u6842\u6797\u627e\u5230\u4e86\u5206\u522b\u6392\u54 0d\u7b2c\u4e8c\u548c\u7b2c\u4e00\u7684\u9999\u6e2f\u4ed4\uff08\u8881\u5bcc\u 534e\u9970\uff09\u548c\u725\u5934\u7684\u7ebf\u7d22\uff0c\u968f\u540e\u8e0f \u4e0a\u5f81\u9014\u3002\u8d2a\u55d4\u75f4\uff0c\u4e09\u6bd2\u71ac\u714e\uff 0c\u7ea2\u5c18\u6df7\u6c8c\u4e4b\u4eba\uff0c\u88ab\u4e1a\u969c\u7f20\u7ed5\uf f0c\u6c38\u8fdc\u65e0\u6cd5\u8df3\u8131\u56e0\u679c\u8f6e\u56de\u2026\u2026\ u7535\u5f71\u5f15\u7528\u7684\u201c\u5468\u5904\u9664\u4e09\u5bb3\u201d\u517 8\u6545\uff0c\u89c1\u4e8e\u300a\u664b\u4e66\u00b7\u5468\u5904\u4f20\u300\u5 48c\u300a\u4e16\u8bf4\u65b0\u8bed\u300\u3002","vod_douban_id":"36151692"}});

Daten erfolgreich zurückgegeben.Die Aktualisierung ist in Kraft getreten. Gehen Sie zum Backend, um sie zu aktualisieren. Der einzige Nachteil dieser Douban-Sammlung ist, dass sie manuell erfasst werden muss. Klicken Sie, um Informationen zu erhalten und relevante Inhalte von Douban zu sammeln.

Apple CMS sammelt und aktualisiert zum zweiten Mal Douban ID und Douban Score

Beim Sammeln von Daten von Film- und Fernsehressourcenseiten mit Apple CMS fehlen für einige Filme die Bewertungen und Douban-IDs. Beim zweiten Update der Ressourcenseite sind die Douban-ID und die Douban-Bewertung zwar vorhanden, beim Aufrufen der Datenbank kann die Douban-Bewertung jedoch nicht synchron aktualisiert werden. So lösen Sie dieses Problem.

In den sekundären Aktualisierungsregeln der Sammlungsparameterkonfiguration ist keine Douban-Bewertungsoption vorhanden. Sie müssen die Verwaltungsdatei von Apple CMS ändern und die Douban-Bewertungsoption hinzufügen.

Offen application/admin/view/system/configcollect.html Linie 155

Fügen Sie unten den folgenden Code hinzu


Dann öffnen Anwendung/allgemein/Modell/Collect.php Ersetzen Sie den Code in Zeile 539.

Originalcode

if($config['score']==1) { $v['vod_score_num'] = Rand(1, 1000); $v['vod_score_all'] = $v['vod_score_num'] * Rand(1, 10); $v['vod_score'] = Runde($v['vod_score_all'] / $v['vod_score_num'], 1); }

Ersetzen durch

if($config['score']==1) { $v['vod_score_num'] = Rand(1, 1000); $v['vod_score_all'] = $v['vod_score_num'] * Rand(1, 10); //$v['vod_score'] = Runde($v['vod_score_all'] / $v['vod_score_num'], 1); $v['vod_score'] = $v['vod_douban_score']; }

Kommentieren Sie //$v['vod_score'] = round($v['vod_score_all'] / $v['vod_score_num'], 1); aus und fügen Sie $v['vod_score'] = $v['vod_douban_score']; hinzu.

Der letzte Schritt, in Zeile 886

if ($config['urlrole'] == 1) {
$tmp1 = explodieren('#',$arr1[$down_key]);
$tmp2 = explodieren('#',$cj_down_url);
$tmp1 = array_merge($tmp1,$tmp2);
$tmp1 = array_unique($tmp1);
$cj_down_url = join('#', (Array)$tmp1);
nicht gesetzt ($tmp1,$tmp2);
}

Fügen Sie unten den folgenden Code hinzu:

 wenn (strpos(',' . $config['uprule'], 'tv')!==false && !empty($v['vod_douban_id']) && $v['vod_douban_id']!=$info['vod_douban_id']) { $update['vod_douban_id'] = $v['vod_douban_id']; } if (strpos(',' . $config['uprule'], 'av')!==false && !empty($v['vod_douban_score']) && $v['vod_douban_score']!=$info['vod_douban_id'] && $v['vod_douban_score'] != 0) { $update['vod_douban_score'] = $v['vod_douban_score']; }

Laden Sie es nach dem Speichern hoch, leeren Sie den Cache im Hintergrund und überprüfen Sie beim nächsten Update einfach die Douban-Bewertung in den zweiten Update-Regeln, um die Douban-Bewertung zu aktualisieren.

 

5/5 - (1 Stimme)

Das ist eine gute Idee

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * Mark