Excellent software and practical tutorials
Douban ratings are invalid in Apple CMS backend, and Douban ratings and related information cannot be obtained
Apple cms是一套不可多得的影视cms,可以轻松搭建一个Free Movies网站,由于包含大量的版权纠纷,导致苹果cms官方一直无人更新维护,目前属于无维护状态,程序后台的自动获取Douban RatingThe function cannot obtain ratings and information due to the update of Douban API. Let's solve this problem.
Manually query Douban ratings and video data
Below is the source code of the Apple CMS v10 Douban rating information collection API interface. Copy and save the PHP source code as douban.php
Then upload douban.php to the root directory of the website.
","
", $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]; } ?>Then open the website's /application/admin/view/vod/info.html file in FTP,
search:
url: '
Line 719
timeout: 5000, url: '//' + 'api' + '.' + 'mac'+ 'cms' + '.'+ 'la' + '/douban/index/id/' + id,Replace the above two lines with:
timeout: 10000, url: 'https://yourdomain/douban.php?id=' + id,
Now after clicking to query the data, you can successfully obtain Douban ratings and related content.
To test whether the douban.php file returns any data, add ?id=36151692 after the file, where the number is the Douban ID.
https://your domain name/douban.php?id=36151692
({"code":1,"auth":"Douban Rating","msg":"Data collection successful","data":{"vod_name":"\u5468\u5904\u9664\u4e09\u5bb3","vod_sub":"The Pig, the Snake, and the Pigeon,\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\u541b\u67d4,\u9ec4\u701a\u5fb7,\u5218\u5b50\u670b,\u7f5 7\u80fd\u534e,\u8bb8\u8389\u5ef7,\u6797\u745e\u534e,\u5218\u79be\u80b2,\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\u533b\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\u725b\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\u300b\u5 48c\u300a\u4e16\u8bf4\u65b0\u8bed\u300b\u3002","vod_douban_id":"36151692"}});Successfully returned data.Douban CollectionIt has taken effect, go to the backend to update it. The only drawback of this Douban collection is that it requires manual collection. You need to click to obtain information in order to collect relevant content from Douban.
Apple CMS collects and updates Douban ID and Douban score for the second time
When using Apple CMS to collect data from film and television resource sites, some films do not have ratings and Douban IDs. When the resource site is updated for the second time, the Douban ID and Douban rating exist, but when entering the database, the Douban rating cannot be updated synchronously. Here is how to solve this problem.
There is no Douban rating option in the secondary update rules of the collection parameter configuration. You need to change the management file of Apple CMS and add the Douban rating option.
Open
application/admin/view/system/configcollect.html
Line 155
Add the following code belowThen open
application/common/model/Collect.php
On line 539, replace the code.Original code
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'] = round($v['vod_score_all'] / $v['vod_score_num'], 1); }Replace with
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'] = round($v['vod_score_all'] / $v['vod_score_num'], 1); $v['vod_score'] = $v['vod_douban_score']; }Comment out //$v['vod_score'] = round($v['vod_score_all'] / $v['vod_score_num'], 1);, and add $v['vod_score'] = $v['vod_douban_score'];
The last step, on line 886
if ($config['urlrole'] == 1) {
$tmp1 = explode('#',$arr1[$down_key]);
$tmp2 = explode('#',$cj_down_url);
$tmp1 = array_merge($tmp1,$tmp2);
$tmp1 = array_unique($tmp1);
$cj_down_url = join('#', (array)$tmp1);
unset($tmp1,$tmp2);
}
Add the following code below:
if (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']; }Upload after saving, clear the cache in the background, and when you update again, just check Douban rating in the second update rules to update the Douban rating.